Results 1 to 4 of 4
  1. #1
    steven7 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    May 2016
    Posts
    13

    Auto run converted Macro

    Hi,

    I have set up a macro to write excel files into a specified folder and then quit access altogether. In order to delete the existing files, I had to convert to VB and add a kill function.

    Is there any way I can have this converted macro run from a desktop icon without having to open the macro and run it from the toolbar?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,515
    if you want to run an access macro, you must open access and run the macro. (which can be done from a desktop icon)

    in the access db, create a macro called autoexec, in this macro put in your code. (or run another macro)
    when you dbl-click the icon, (shortcut to the db) it will open, run your code, and close.

  3. #3
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Or use the msaccess build in /x switch as described here: https://support.office.com/en-us/art...5df9702bf1#bm3 in combination with a .lnk file if you don't always want to run your macro at startup.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,702
    Have you employed any protection that prevents anyone from running the macro in the db or using a shortcut and deleting the files when not wanted? Since you have already converted your macro to code, it's not too much more effort to employ code based protection. Alternately, I guess you can create a macro as suggested (to run code that was a macro) and get a confirmation from the user via a yes/no message box. One way listed in the provided link is the /cmd switch, which I have used in the past.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. macro auto filling
    By chr1stoper1 in forum Macros
    Replies: 6
    Last Post: 09-12-2015, 10:32 AM
  2. Using macro converted to VBA in other functions
    By gaker10 in forum Programming
    Replies: 4
    Last Post: 08-19-2014, 07:44 AM
  3. Converted macro to VBA not working
    By gemadan96 in forum Forms
    Replies: 5
    Last Post: 06-04-2014, 10:36 AM
  4. Assign converted macro to navigation panel button
    By nhylan in forum Programming
    Replies: 4
    Last Post: 04-17-2013, 01:33 PM
  5. Macro to Auto Filter
    By skinny1434 in forum Access
    Replies: 1
    Last Post: 06-14-2012, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums