Shakeable_Drip
Board Regular
- Joined
- May 30, 2023
- Messages
- 52
- Office Version
- 365
- Platform
- Windows
my sub to save as PDF is failing and I cant figure out why. "runtime error 1004: document not save. the Document may be open, or an error may have been encountered when saving"
The print Debug gives me a good path, am I using this incorrectly? debug= "strSourceFolder\TEST 999.pdf"
Ah well I think the error is in the save path, I dont know how to correct this
The print Debug gives me a good path, am I using this incorrectly? debug= "strSourceFolder\TEST 999.pdf"
Ah well I think the error is in the save path, I dont know how to correct this
VBA Code:
Sub SaveAsPDF()
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim strSourceFolder As String
Dim order As String
Dim SaveLocation As String
Set sht1 = Sheets("HELPER")
Set sht2 = Sheets("REPORTS")
strSourceFolder = ActiveWorkbook.Path 'Source path
order = sht1.Cells(13, 22)
SaveLocation = "strSourceFolder" & "\" & order & ".pdf"
'Debug.Print SaveLocation
sht2.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=SaveLocation
End Sub