I have the code below that should save an excel worksheet as a pdf file
However, at the line: .ExportAsFixedFormat Type:=xlTypePDF, FileName:=FullPath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
I get this error:
Not document is Not Open
Anybody know why I'm failing here?
Thanks for looking
However, at the line: .ExportAsFixedFormat Type:=xlTypePDF, FileName:=FullPath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
I get this error:
Not document is Not Open
Code:
Private Sub SaveQuotationAsPDF(cell As Range)
Dim FileName As String, FullPath As String
With ActiveSheet
FileName = .Range("J7").Value & "-" & .Range("j8").Value
FullPath = Environ$("OneDrive") & "\MJM Services\2.0 Quotations\pdf Copy\" & FileName & ".pdf"
.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FullPath, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
cell.Parent.Hyperlinks.Add cell, FullPath, TextToDisplay:="Open Quotation"
End Sub
Anybody know why I'm failing here?
Thanks for looking