How to run macro with scheduler

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the best way to run an excel macro with the scheduler??
- is it possible to run the macro on file open?? how
- is it possible to run directly the macro as a VBA file??
- maybee another way??

thanks
 
You would store the macro code in Thisworkbook module as a Workbook_Open sub
then use task scheduler to start Excel with that workbook to open.

Or store the macro in a general module and name it Sub Auto_Open() and open
workbook using task scheduler as above.


Gord Dibben MS Excel MVP
 
Maybe explain a little more about what you want to do?

Can you run the macro on File Open? Yes. Use the Workbook's
Workbook_Open() event process to either run the code or to make a call to the
code if written into another module. To get to the Workbook's _Open() event
section, right click on the Excel icon to the left of the word "File" in the
menu bar and choose [View Code] from the list that appears. In the lefthand
pulldown above the large code module area, choose Workbook, and
Workbook_Open() is the default 'stub' that will be started for you.

Can you run the code as a VBA file? No. The Excel file has to be open for
the code in it to be executed.
 
Thanks - it works

Gord Dibben said:
You would store the macro code in Thisworkbook module as a Workbook_Open sub
then use task scheduler to start Excel with that workbook to open.

Or store the macro in a general module and name it Sub Auto_Open() and open
workbook using task scheduler as above.


Gord Dibben MS Excel MVP
 
thanks a lot - it works

JLatham said:
Maybe explain a little more about what you want to do?

Can you run the macro on File Open? Yes. Use the Workbook's
Workbook_Open() event process to either run the code or to make a call to the
code if written into another module. To get to the Workbook's _Open() event
section, right click on the Excel icon to the left of the word "File" in the
menu bar and choose [View Code] from the list that appears. In the lefthand
pulldown above the large code module area, choose Workbook, and
Workbook_Open() is the default 'stub' that will be started for you.

Can you run the code as a VBA file? No. The Excel file has to be open for
the code in it to be executed.

Dan said:
What is the best way to run an excel macro with the scheduler??
- is it possible to run the macro on file open?? how
- is it possible to run directly the macro as a VBA file??
- maybee another way??

thanks
 
Back
Top