Startup with a Macro

S

SA

From a command line I need to start Excel, open a specific
Excel file, execute a macro in that file and then close
the file with a save. This is to be done only at specific
times and not every time I open the Excel file.
Is there a command line option to start an Excel macro
like the one they have in ACCESS.
Any help would be appreciated.
 
F

Frank Kabel

Hi
you could rename your macro to
Auto_Open()

or put the code in the workbook event
workbook_oen()
 
S

SA

The Auto_Open executes the Macro when ever one opens the
Excel file. At times I just need to open the Excel file
and not have the macro executed. I haven't tried the
workbook_open() yet.
Thanks
 
S

SidBord

I'm not sure what you mean by "from the command line"? At
the time you want to execute this "open-run-close" sequence
are you sitting looking at your spread sheet, or is this
supposed to happen within a macro that's executing? If you
are looking at the spreadsheet and decide tro initiate the
sequence, are you willing to press a button (like one
created with an AutoShape rectangle) that has a macro
assigned to it?
 
S

SA

This is what I am trying to do:
- I have a Workbook with a two macros that perform
different actions on the same worksheet.
- I need to schedule the execution of the macros at two
different time T & T+X.
- I am thinking of using Windows scheduler to do this.
- At time T Scheduler executes "Open file - Execute Macro1
and Close file".
- At time T+X Scheduler executes "Open file - Execute
Macro2 and Close file".
- The Macros are to be executed without any external
interference. They are to be time triggered by the
scheduler.
 
Top