ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing multi-page and multi-orientation excel tab to PDF (https://www.excelbanter.com/excel-programming/440660-printing-multi-page-multi-orientation-excel-tab-pdf.html)

JoeM[_3_]

Printing multi-page and multi-orientation excel tab to PDF
 
Could someone let me know if it is possible to print a multi-page tab in
Excel to a PDF with multiple page orientations? Currently, I am setting the
print area for each of the four pages and then printing each page seperatly
to a PDF. Once complete I am combining each page into one PDF. I need all
pages to print to one PDF with the proper size and orientation.

My code is included below.

Thank you in adavance for your help,

Joe M


Private Sub CommandButton2_Click()

ans = MsgBox("Do you want to Export the Input page to PDF?", vbYesNo,
"Confirmation")
If ans = vbYes Then

Sheets("Input").Select
Sheets("Input").Activate
Application.ActivePrinter = "Adobe PDF on Ne01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne01:", Collate:=True
Sheets("Input").Select

Sheets("Input").Select
Sheets("Input").Activate

'Prints Page 1 of Input tab
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

Range("AssumptionsPrintArea").PrintOut

'Prints Page 2 of Input tab
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

Range("EquityPrintArea").PrintOut

'Prints Page 3 of Input tab
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

Range("RentAndExpensePrintArea").PrintOut

'Prints Page 4 of Input tab
With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PaperSize = xlPaperLegal
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

Range("SourcesUsesPrintArea").PrintOut

'resets the Page Setup to landscape and 4 pages long.
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 4
End With

End If

End Sub



All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com