View Single Post
 
Old 01-19-2014, 08:53 AM
doctor_who12 doctor_who12 is offline Windows 8 Office 2013
Novice
 
Join Date: Jan 2014
Posts: 1
doctor_who12 is on a distinguished road
Default Run-time error '1004': Document not saved. The document may be open...

Hi,
I am trying to make a macro that exports the current sheet as a PDF as 'invoice [cell value].pdf. I keep trying different things and am getting this error:
Run-time error '1004': Document not saved. The document may be open, or an error may have been encountered when saving.

This is my macro:

Sub Savei()

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="C:\invoice" & Range("G3") & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
OpenAfterPublish:=True

End Sub

Thanks in advance.
Reply With Quote