+ Reply to Thread
Results 1 to 3 of 3

Auto Schedule Excel VBA code to run

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

    Auto Schedule Excel VBA code to run

    I am trying to auto schedule a macro within excel to run during a certain time of day every day. I am able to use Scheduler to open up the excel file, but from that point, I am not sure how to get the macro to run within the time frame.
    Below is a portion of the method to trigger the timer in access but I am not sure of how to do it in excel. Does anyone have any advice on how to do this.Thanks
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    03-14-2012
    Location
    Arizona USA
    MS-Off Ver
    Excel 2000/2007
    Posts
    408

    Re: Auto Schedule Excel VBA code to run

    Timing code to run at certain times or on a repeating schedule can be done in two ways.

    1. By using the windows task scheduler. Here you must use either the Workbook_Open or Auto_Open to run your code. At the end of the macro you should exit out of Excel(not just the workbook).

    2. By leaving your workbook open and setting up a timer to monitor the system clock. This method can be done in a couple ways. You could use an OCX timer on an open userform. Or you could do something like this;

    Please Login or Register  to view this content.
    In the code "DoMyCode" you need to ensure that it does not start again before it has finish. You may also want to add a 1 second delay in this code too so that it only runs once in a 24 hour period.

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

    Re: Auto Schedule Excel VBA code to run

    thanks. What code would I use for Auto Open or Workbook Open. This seems like the better option for me since i would want to combine it with the scheduler and have it open the file and then close it after the task is performed.

    Thanks for the help.

+ 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