Run Macro with Command Line - VBS & BAT @pp_92

PHOTO EMBED

Sun Feb 20 2022 03:03:59 GMT+0000 (Coordinated Universal Time)

Saved by @pharehphatah #vba #vbs

// .vbs file
Dim args, objExcel

set args = wscript.Arguments
set objExcel = createobject("Excel.Application")

objExcel.workbooks.open args(0) 
objExcel.visible = True

objExcel.Run "Module1.Macro1"
objExcel.Activeworkbook.Save 
objExcel.Activeworkbook.Close(0)
objExcel.Quit



// .bat file
cscript "C:\Users\phareh_92(2)\Documents\X.vbs" "C:\Users\phareh_92(2)\Documents\Y.xlsm"
content_copyCOPY

Run Excel File with CLI (Command Line Interface)