I have a VBScript below that opens an excel workbook and runs the VBA script inside that will check and order the tools that calibration dates are either out or due in the next month and then email me a copy of it.
Dim xlApp, xlBook
Set xlApp = CreateObject("Excel.Application")
' Prevent Excel from popping up
xlApp.Visible = False
' Change to your actual file path
Set xlBook = xlApp.Workbooks.Open("C:\Users\Todd Harris\Desktop\Monthly Calibration Report.xlsm", 0, True)
' Run your macro name
xlApp.Run "CopyDatesAndEmail"
xlBook.Close False
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
This runs perfectly fine when I manually double click the VBScript
I would like to set this up so it automatically runs at the start of each month and found out you can use Task Scheduler but so far all my attempts using it have never run the VBScript.
I have tried ticking "Run with highest privileges", Change User or Groups to "Administrators", the Actions I have set (Program/script: wscript.exe) (Add arguments: "C:\Users\Todd Harris\Desktop\RunMonthlyCalibrationReport.vbs") (Start in: C:\Users\Todd Harris\Desktop\)
I also tried to use a bat file with the below code but wasn't sure on how to set the actions up on that one.
@echo off
cscript.exe "C:\Users\Todd Harris\Desktop\RunMonthlyCalibrationReport.vbs"
Not sure where else to go with this.