📎 AI Summary:
The thread discusses an issue where Excel macros that run and close normally when opened manually fail to close the application when launched via Windows Task Scheduler on a 32-bit Windows 7 system, although it works fine on 64-bit versions. The original poster seeks solutions for why Excel remains open after macro execution in this specific environment. A responder suggests verifying macro security settings and proper file path formatting, but overall, the problem remains unresolved within the thread.

Steven H

New Member
Joined
Nov 14, 2013
Messages
1
Thread Author #1
I want to use the Task Scheduler to open an Excel file. The Excel file contains a macro that automatically runs when the file is opened. At the end of the routine the macro saves the file and closes the Excel application using the following commands:
>ThisWorkbook.Save
>Application.Quit

When I open this excel file in a normal way, such as double-clicking on the file, the macro runs successfully and Excel closes. However, when I use the Task Scheduler to open the excel file, the Excel Application does not close when the routine is finished.

Note that I’ve tried using the Task Scheduler to open this Excel file on other computers that are running the 64 bit version of Windows 7 and it works flawlessly. I’m only having this issue on a computer that is running the 32 bit version. Any ideas?
 

Solution
I want to use the Task Scheduler to open an Excel file. The Excel file contains a macro that automatically runs when the file is opened. At the end of the routine the macro saves the file and closes the Excel application using the following commands:
>ThisWorkbook.Save
>Application.Quit

When I open this excel file in a normal way, such as double-clicking on the file, the macro runs successfully and Excel closes. However, when I use the Task Scheduler to open the excel file, the Excel Application does not close when the routine is finished.

Note that I’ve tried using the Task Scheduler to open this Excel file on other computers that are running the 64 bit version of Windows 7 and it works flawlessly. I’m only having this issue...

Fixer1234

Senior Member
Joined
Aug 3, 2012
Messages
481
I want to use the Task Scheduler to open an Excel file. The Excel file contains a macro that automatically runs when the file is opened. At the end of the routine the macro saves the file and closes the Excel application using the following commands:
>ThisWorkbook.Save
>Application.Quit

When I open this excel file in a normal way, such as double-clicking on the file, the macro runs successfully and Excel closes. However, when I use the Task Scheduler to open the excel file, the Excel Application does not close when the routine is finished.

Note that I’ve tried using the Task Scheduler to open this Excel file on other computers that are running the 64 bit version of Windows 7 and it works flawlessly. I’m only having this issue on a computer that is running the 32 bit version. Any ideas?

It's not clear from your description whether the file loads and runs but fails to complete or Excel opens but the file does not run at all. If the file loads but fails to complete, I can't think of anything off the top of my head. If the file macro doesn't run at all, here are a few "idiot" suggestions (like did you check to make sure the computer is plugged in):

Make sure that the macros feature has been installed for Excel.

Check the macro security settings in Excel (Office Button (upper left) --> Excel Options --> Trust Center).

I assume you're passing the filename as an argument in Task Scheduler. If the file is not loading, play with the quotes (try no quotes, try putting the entire argument string in quotes, try putting just the fully qualified filename in quotes).
 

Solution