Excel VBA - intermittant problem saving to desktop

SiobhanF

New Member
Joined
Jul 20, 2016
Messages
1
Hello all

I am having problems with a colleague sometimes being unable to run a macro which saves PDFs to the desktop. I haven't found a solution online, so I'm hoping someone here might know what is going on.

The macro picks up the file path (sUserPth) from a cell in the active worksheet, runs through a few lines of code to prepare the sheet to be exported to PDF, and then creates the PDF as follows:

ChDir sUserPth
pd.Range(Cells(1, 3), Cells(iBlankEnd + 5, 23)).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
lg.Cells(i, 17).Value, OpenAfterPublish:=False

This works for almost everybody (assuming we have the correct file path saved in the cell). However I have one colleague for whom it regularly doesn't work. He is on different systems, as he works for an outsourcing company, so I have been wondering if something here is causing the issue. Whereas the rest of us work on Excel installed directly on our laptops, he has to log into Excel via Citrix.

For example, this morning he got an error stopping at this line of code saying the file path wasn't found. After restarting his computer the macro worked without any problems. :confused:

Unfortunately we cannot take the easiest route and bring this file back in house, as it is a report that has been contracted out and will cause all sorts of issues with service contracts.

Thank you!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,216,084
Messages
6,128,722
Members
449,465
Latest member
TAKLAM

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