Akshay_divecha
Board Regular
- Joined
- Mar 11, 2014
- Messages
- 70
Hi Exports,
I am trying to save excel worksheet to PDF however encountering runtime error 1004 with the msg with reads as "Document not saved. The document may be open, or an error may have been encountered while saving.
when clicked on deburg, below in bold is highlited in yellow.
Kindly help to fix this.
I am trying to save excel worksheet to PDF however encountering runtime error 1004 with the msg with reads as "Document not saved. The document may be open, or an error may have been encountered while saving.
when clicked on deburg, below in bold is highlited in yellow.
Kindly help to fix this.
Code:
Sub DesktopPDF()
'Set path to Desktop
fPath = "C:\Users\divecak\Desktop"
'Build File Name from Sheet1 I8, A11 & H11
fName = Sheets(1).Range("I8") & " - " & _
Sheets(1).Range("A11") & " - " & _
Sheets(1).Range("H11")
'Export as PDF to Desktop
[B] ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fPath & fName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True[/B]
End Sub