0

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.

Karthick Raju
  • 757
  • 8
  • 29

1 Answers1

0

After a long search, found an answer here

Solution for the issue is to have directory structure c:\windows\syswow64\config\systemprofile\desktop

I do not know how it started working for me. Believe me, this helped for lot of people in the blog

Karthick Raju
  • 757
  • 8
  • 29