I have a windows service that calls VBScript. In VBScript, I have a lot of functions and at the end of all execution I call VBA Macro file. Everything is working as expected, expect calling VBA Macro.
Below is the VBScript code to call VBA Macro file
sub OpenVBAMacroFile ()
Set xlApp = CreateObject("Excel.Application")
Set XlBook = xlApp.Workbooks.Open("C:\VBAMacroFile.xlsm")
xlApp.Run "DataRefresh2"
Set xlBook = Nothing
Set xlApp = Nothing
end sub
When I run VBScript manually, VBA Macro file is opening successfully. But, when I run through Windows service, VBAM Macro file is not opening.
Any help is highly appreciated.