Excel Convert excel sheet to pdf, faulty vba code

Joined
Mar 5, 2010
Messages
1
Reaction score
0
Hi,

I have a macro in excel to save a sheet to pdf with a defined filename and location. This code have been working untill now, getting the 1004 error, document not saved.
Anyone out there who could figure this one out?

My Code:
Sub printpdf()

Application.ScreenUpdating = False

myfilenumber = CStr(ActiveSheet.Range("F2") & ActiveSheet.Range("G2"))
MyFilename = "C:\Users\......\skjema\FR\FR-" + myfilenumber + "- " + ActiveSheet.Range("E14") + ".pdf"


ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyFilename, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True



End Sub

Regards Terje
 
Back
Top