I have a .bat file that is one line long and calls up a vb script that specifically opens an excel file and runs some macros:
cscript priordays.vbs "C:\PATHANME\FILENAME.xlsm"
When I run it by double clicking, it runs fine and successfully.
When I run in task scheduler, it says it ran successfully (code 0x0), but the script does not execute. I've got it set to run with highest permissions, regardless of whether or not the user is logged in, wake machine, etc. Still nothing.
For those asking what's in the vb script, it's:
Dim arts, objExcel Set args = WScript.ARguments Set objExcel = CreateObject("Excel.Application") objExcel.Workbooks.Open args(0) objExcel.visible = True objExcel.Run "Macro1" objExcel.Run "Macro2" objExcel.Run "Macro3" objWorkbook.Close objExcel.Quit
I found that code elsewhere on this site, along with the instructions on using the .bat file. If there's a way to run it all from the script, and try to launch the script from task scheduler, I'm fine to do that as well.