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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top