Remote Desktop Breaks my Automated Excel Printing Macro

CyberCorenez

New Member
Joined
Aug 25, 2020
Messages
2
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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.

Code:
 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
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
@CyberCorenez
While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered elsewhere.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top