how to show excel when running as scheduled task

2

When I schedule a task on Windows Server 2012 to run an excel file, it always runs in the background. This makes trouble to me as when the vba of the excel file failed, I could not tell which step it was down.

Seems Windows Server is different from desktop version, when I schedule tasks to run excel on Windows 7, it always show up.

How to schedule tasks to run Excel visibly on Windows Server 2012? I checked Excel Command-line switches, but to no avail.

athos

Posted 2017-02-24T01:51:39.220

Reputation: 1 954

Answers

1

How to show excel when running as scheduled task

Since you're using Windows Task Scheduler, you can simple ensure a few things...

  1. Be sure the Run only when the user is logged on option is selected within the General tab
  2. Be sure the Run with highest privileges option is selected within the General tab
  3. Be sure the Hidden option within the General tab is NOT selected
  4. 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

Pimp Juice IT

Posted 2017-02-24T01:51:39.220

Reputation: 29 425

@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.907

what 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