+ Reply to Thread
Results 1 to 4 of 4

VBA code to trigger Auto_Run Macro (Scheduler)

  1. #1
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    VBA code to trigger Auto_Run Macro (Scheduler)

    I currently have a workbook with multiple tabs and the there is a macro in the tab called "Summary". I am trying to link the macro to a scheduler. Currently, I have a scheduler that will open the file, but I am trying to get the file to open and the macro to run as soon as the file is opened and then have the file close when the macro has run? does anyone what code to use to auto run the macro if the macro is on one tab out of 7 tabs in the workbook?

    Thanks

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: VBA code to trigger Auto_Run Macro (Scheduler)

    You would use the workbook_open event - essentially you can add an excel workbook to windows task scheduler and this will open the workbook. Then in the workbook open event just call the macro
    Please Login or Register  to view this content.
    This would be place in ThisWorkbook in the VB editor.
    Is that what you mean?
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: VBA code to trigger Auto_Run Macro (Scheduler)

    Yes that worked thanks. I am trying to figure out how to prevent the Enable Macro Security popup from generating. When I disabled it in the Tools>macro security settings, it did not save the change and the box continued to pop up as the file was opened.

    Thanks for the help.

  4. #4
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: VBA code to trigger Auto_Run Macro (Scheduler)

    If you want to disable the pop up from generating and allow the macro to run then set it to Enable All Macros (however consider consequences/potential) for malicious code and tick Trust access to the VBA project object model. If you want to disable pop up and prevent code running then select disable all macros without notification.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1