I need to run automatically an excel macro that PDFs a monthly report and then saves and closes the excel file. My proposed solution is that using Windows Task Scheduler it runs a windows batch print file that runs a VBScript which then runs the excel file. The excel file when it is open then runs a macro that PDFs what I need. All of this I have tested many times locally on my PC and all of it works fine. Now this all needs to run on a remote desktop that is a virtual machine. This is where the issue happens. Everything runs fine up until it opens the excel file, the excel file opens in the background and its icon on the task bar flashes orange, because of this nothing else happens. The macro breaks and does not print, it doesn't even start in the first place. Is there any ideas on how to fix this? I think that it is something in the VBScript that causes this to happen since it is here that the process stops. Here is the coding for the VBScript that opens the excel file.
Dim args, objExcel, openExcel Set args = wScript.Arguments Set objExcel = CreateObject("Excel.Application") objExcel.Workbooks.Open args(0) objExcel.Visible = True objExcel.Run "ReportPrint" objExcel.ActiveWorkbook.Save objExcel.ActiveWorkbook.Close(0) objExcel.Quit