SQL Job doesn't run vbs Script file

dearnemo
dearnemo used Ask the Experts™
on
In reference to this thread: http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_27727445.html#a37999278

Now I tried to run my vbs script from SQL Job. Though I get Job executed successfully, it didn't open up my excel file. I went to view the history for this job and found

Message
Executed as user: GSOPS4\SYSTEM. Microsoft (R) Windows Script Host Version 5.7  Copyright (C) Microsoft Corporation. All rights reserved.C:\WINDOWS\system32\TestTOPTMay307.vbs(5, 1) Microsoft Excel: Microsoft Excel cannot access the file '\\gsops4\data_extracts\TestTOPTMay307.xlsm'. There are several possible reasons:     The file name or path does not exist.   The file is being used by another program.   The workbook you are trying to save has the same name as a currently open workbook.  Process Exit Code 0.  The step succeeded.

Any thoughts?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
try this
Under component services > Computers > My Computer > DCOM Config + Microsoft Excel application > properties > Identity Tab > Select the Interactive User > Ok.

 

You'll also what to add this to the bottom of your script so Excel closes and does not hang around in the background.

$excel.Quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel)

http://technet.microsoft.com/en-us/library/ff730962.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial