PDA

View Full Version : [SOLVED:] Made VBS to Run Macro, but it doesen't



johngalvin
10-03-2019, 11:34 PM
This is what I placed in 1.vbs, please note that the Macro is within a Module



Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "'C:\Users\John\Documents\Folder\1\1.xlsm'!MacroinModule"
objExcel.DisplayAlerts = False
Set objExcel = Nothing



The .vbs runs, then I see at the Modified date that it updates to the time when the .vbs ran, but the macro doesen't work inside the .xlsm when the .vbs is running. The macro works just after opening Excel and pressing the "Run" Button

Any idea why?

Thanks
John

Bob Phillips
10-04-2019, 07:42 AM
Don't you need to open the workbook within that excel object, set an object to that, and run the macro within that object.

johngalvin
10-04-2019, 01:56 PM
Thank you, it worked !