Access Beginner
Active Member
- Joined
- Nov 8, 2010
- Messages
- 311
- Office Version
- 2016
- Platform
- Windows
Hi All,
The below code creates a PDF from a named range in cell A55 on the "Menu" sheet and saves this to a folder based in a value in cell A52 on the "Menu" sheet.
What I'd like to achieve, is that if the value of cell A115 on the "Menu" sheet is "Zone" then output the PDF file to a path in cell A116 on the "Menu" sheet.
The below code creates a PDF from a named range in cell A55 on the "Menu" sheet and saves this to a folder based in a value in cell A52 on the "Menu" sheet.
What I'd like to achieve, is that if the value of cell A115 on the "Menu" sheet is "Zone" then output the PDF file to a path in cell A116 on the "Menu" sheet.
Code:
Sub PDFPrinttest()
Dim ReportPath As Variant
Dim ReportName As Variant
Dim ToPrint As Variant
Set ReportPath = Sheets("Menu").Range("A32")
Set ReportName = Sheets("Menu").Range("A52")
Set ToPrint = Sheets("Menu").Range("A55")
Worksheets("IOverview5").Activate
With ActiveSheet
.PageSetup.PrintArea = ToPrint
.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=ReportPath & ReportName & ".PDF", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End With
End Sub