Scheduling the printing of an Excel file which has an add-in from the command line using visual basic scripting (vbs) via wscript
On a recent project I was required to print out an Excel based report which made extensive use of OSIsoft PI DataLink's Excel Add-in on a sechduled basis (7am daily). Unfortunately Excel does not easily allow for the printing of an Excel file via the command line via switches or parameters when calling Excel.exe (e.g. C:\Windows\MS Office\Excel.exe -print "C:\Reports\My Report.xls"). I was able to find examples on the Internet which made use of cscript or wscript where one calls VBS code, and where one provides the file name as argument, for example: wscript "C:\Data\My Scripts\printXLS.vbs" "C:\Data\My Reports\Daily Analyser Excursion Report.xls" Note the convention of using "" around full path filenames as they contain spaces. The file printXLS.vbs would contain something akin to the following code: Dim XLApp Dim XLWkbk Dim ObjArgs set ObjArgs = wscript.arguments if ObjArgs.count <> 1 then wscript.echo "Invalid passed arguments&