Forum Discussion

Aern's avatar
Aern
Occasional Visitor
2 years ago

ActiveX component can't create object excel application

I am trying to call .VBS file from ssms.
I.e using exec xp_cmdshell 'cscript "filepath\filename"'

But I am facing error as below. Microsoftvb script runtime error : ActiveX component can't creat object excel.application .

Both vbs file and Excel file are stored in same path.

code of VBS file
'References to Excel
dim xl_app
dim xl_Spreadsheet

SET xl_app = CreateOBJECT("Excel.Application")
xl_app.UserName = "na\#####"
xl_app.DisplayAlerts = False
SET xl_spreadsheet = xl_app.Workbooks.Open("\\######\f$\KT_Docs\Copyofaccessreview.XLSM")
xl_app.Run "TimingControl"
'xl_spreadsheet.Close
xl_app.Quit
set xl_app = Nothing

Please help ..
No RepliesBe the first to reply