I am trying to save a PDF of the sheet that i am working on (only the sheet selected and not the whole workbook)
the file path is written in cell "M12"
the file name that I want to create for the sheet is "E5" then "E6" then "B6"
I have this code but it is not working, think i have typos somewhere in it:
the file path is written in cell "M12"
the file name that I want to create for the sheet is "E5" then "E6" then "B6"
I have this code but it is not working, think i have typos somewhere in it:
VBA Code:
Public Sub Save_Sheets_As_PDF()
Dim PDFfile As String
Dim currentSheet As Worksheet
With ActiveWorkbook
PDFfile = .ActiveSheet.Range("m12").Value
If Right(PDFfile, 1) <> "\" Then PDFfile = PDFfile & "\"
PDFfile = PDFfile & .ActiveSheet.Range("e5" & "E6" & "b6").Value
Set currentSheet = .ActiveSheet
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=PDFfile, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
currentSheet.Select
MsgBox "Created " & PDFfile
End With
End Sub