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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,214,887
Messages
6,122,095
Members
449,064
Latest member
Danger_SF

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