Running a job from AutoSys and I am getting an error.
VBS runs an excel macro.
VBS code :
Option Explicit Dim xlApp, xlBook Set xlApp = CreateObject("Excel.Application") On Error Resume Next set xlBook = xlApp.Workbooks.Open("Z:\Confidential Restricted\Weekly_HR_Employees_Macro.xlsm",0, False) xlApp.Run "Weekly_HR_Employees_Macro.Weekly_HR_Employees_Macro" xlBook.Close True xlApp.Quit set xlBook = Nothing Set xlApp = Nothing
Microsoft VBScript runtime error: ActiveX component can't create object: 'Excel.Application'
You are using
GetObject syntax with
CreateObject method. You need to use:
Set xlApp = CreateObject("Excel.Application")
this answer for more details.
Although the script runs on my machine, it would not run on the machine that the AutoSys job was using. I eventually found that the machine that was being used by the Autosys job does not have Microsoft Office installed.
You can use GetObject(“Excel.Application”), but you need to make sure you open up an instance of excel before you use it. GetObject will get a reference to this open instance of Excel and let you use that.