Hello, i'm attempting to print specific sheets as a single .pdf document. I have referenced several other threads, but I still seem to be missing something. The code I have does begin to publish the documents, but then errors out. I have confirmed that both the filename and path are populated correctly.
Sub printer()
Dim FName As String
Dim FPath As String
FName = Sheets("Project Description").Range("L3")
FPath = "C:\" & FName & ".pdf"
Sheets("Project Description").Activate
ThisWorkbook.Sheets(Array("Test 1", "Test 2")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
FPath, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
Thank you for your help.
Sub printer()
Dim FName As String
Dim FPath As String
FName = Sheets("Project Description").Range("L3")
FPath = "C:\" & FName & ".pdf"
Sheets("Project Description").Activate
ThisWorkbook.Sheets(Array("Test 1", "Test 2")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
FPath, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
Thank you for your help.