Error creating pdf files from Excel 2013 macro

KathyS_893

New Member
Joined
Apr 7, 2013
Messages
1
I have just moved from a laptop running XP/Excel 2007 to a laptop running Windows 8 64-bit/Excel 2013.

I have a .xlsm file that contains a macro which prints various sheets from the graph into 7 pdf files stored in other folders. The part of code that creates (i.e. overwrites the existing pdfs) is:

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
myPath & myfilename & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False

The value of myPath is derived from the workbook's path. This macro has always worked fine on my old laptop, and has been running successfully on other XP/Excel 2007 computers that share the same folder structure.

However on my Windows 8 laptop running Excel 2013, it usually reports a 1004 error (i.e. can't save the file) on the first instance of the above code. However the first pdf file HAS actually been created. Also, if I re-run the macro, sometimes it will create 3 or 4 of the pdf files, and fail (with the same error) only on the last ones.

Does anyone have any ideas about what could be causing this change in behaviour, or can anyone suggest a better method of reliably creating these pdf files in Excel 2013?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,987
Messages
5,834,716
Members
430,313
Latest member
smartykatwinks

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
Top