How to show excel when running as scheduled task
Since you're using Windows Task Scheduler, you can simple ensure a few things...
- Be sure the
Run only when the user is logged on
option is selected within the General
tab
- Be sure the
Run with highest privileges
option is selected within the General
tab
- Be sure the
Hidden
option within the General
tab is NOT selected
- Last but not least, you need to ensure that the account you run this task as or the account which you are signed onto the server as when you make these adjustments is logged on at the scheduled run time or else the task will not run at all.
NOTE: This works fine for me with running tasks from Windows 7 to Windows Server 2012 R2 and is a standard practice I use to test new processes before promoting to production, and to troubleshoot existing processes already in production that are scheduled with Windows Task Scheduler.
Additionally, You should consider researching and testing this process you have that runs to see if you can put some advanced or verbose logging of the process to a log file somewhere so if needed, you can check this file to help troubleshoot if possible and run it
![enter image description here](../../I/static/images/096d1c07eefc4b50ab5d6637fe1e64e0e9af70e47834ff27c840179e549855ee.png)
@McDonalds no, i've tried that and it doesn't work. the excel file is opened, book_open event triggered, then automatically closed. – athos – 2017-08-14T23:43:02.597
i delete previous discussion as they are more about if account need login while now my testing shows it's a bit unrelated -- even though it's always logged in, the scheduled job is executed and the excel file did run (i write a short macro in workbook_open to update cell
a1
the current time and save) but afterwards it closed and didn't show up. Thx for your reply, let me digest. – athos – 2017-08-15T07:14:39.907what i did is quite simple, on test.xlsm > ThisWorkbook, i put
Private Sub Workbook_Open() Cells(1, 1) = Now() Cells(1, 2) = Application.UserName ActiveWorkbook.Save End Sub
Then at scheduler, i added a task, run as highest privileges, that run test.xlsm. What I observe is, whether I right click the task to run or let the task to run as scheduled,test.xlsm will be run and then closed, with out the excel window being seen. – athos – 2017-08-15T22:48:47.177