rcicconetti
New Member
- Joined
- Jan 16, 2016
- Messages
- 34
I had this code working with no problem, now it's giving me an error '1004' Document not Saved. Document may be open, or an error may have occured when saving. Don't know where I went wrong...any help is appreciated.
Code:
Sub savetopdf()'
' savetopdf Macro
'
Dim saveFileName As String
Dim PDFranges As Range
With ActiveSheet
saveFileName = CreateObject("WScript.Shell").SpecialFolders("MyDocuments") & .Range("T3").Value & ".pdf"
Set PDFranges = .Range("X3:AC48,AE3:AJ48,AL3:AQ48,AS3:AX48,AA59:AF104,AH59:AM104,AO59:AT104")
End With
PDFranges.ExportAsFixedFormat Type:=xlTypePDF, Filename:=saveFileName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
'
End Sub