PDA

View Full Version : Executing Macro at Time with Excel Closed



jackerman09
07-22-2010, 12:45 PM
I've been looking for a way to execute a macro at a certain time without excel being open already, and below I detail what I've done so far. I just want to get a few opinions making sure I'm not missing something or doing something wrong.

I created a workbook called OnTimeMacroRunning and saved it in the XLStart folder, so that it automatically opens whenever I open Excel.

Then I used task scheduler (just used the wizard, no coding) to have Excel open every weekday morning at 6:30AM.

I wrote a macro in OnTimeMacroRunning that executes when the OnTimeMacroRunning is opened (which opens when task scheduler starts excel) that checks what time it is, if it's within 6:30 to 6:35 AM, it runs the macro I need to run, then it closes Excel.

I used If statements so that it checks the time and runs a few different macro's from different workbooks depending on the time of day, and as of now I have the task scheduler opening Excel several times a day within the appropriate time ranges to trigger the macro to run.

Any thoughts on a better way to do this or if I'm doing anything blatantly wrong? It seems to be working so far, but I'll know for sure tomorrow morning if I get the file emailed to me automatically.

Thanks in advance,

Jason