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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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