Execute macro at pre-set time

  • Thread starter Thread starter Jean
  • Start date Start date
J

Jean

Does anybody know how to make an Excel macro/VBA procedure
execute automatically at pre-set time (for instance, at
mid night)?
 
Chip:

Thank you so much for your promt resonse and the simple
and solution, which is clear and easy to understand. I
will try it after lunch. Regards,

Jean
 
What are the pros and cons of using Ontime vs the windows scheduler with the
code called in the workbook_open event - is there a preference? We want to
schedule different macros to run on different days (nights) instead of
hogging CPUs during the day...
 
Jean

Another tack if you don't have Excel running at all times.

Put the macro in the Workbook_Open code and use Task Scheduler to start Excel
and your file at midnight.

Add code to save the file then shutdown Excel(Application.Quit)

Gord Dibben Excel MVP
 
Keith,

The only real difference is that OnTime requires that Excel be
running at the specified time. Using Windows scheduler does not
require that Excel be open.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Gord:

Thanks for your response. Doing the same thing without
openning Excel workbook definitely is a good solution.
However, I have no idea how to use Task Scheduler, and
even don't know what's the Task Scheduler. Could you give
me a little detailed explanation?

Jean
 
Chip:

I have visited your Web pages and tried your code. The
StartTimer() works very well, and I like it so much. I
also like your Web pages and will come back more often.
Again, thanks for your help.

Jean
 
Back
Top