Hello everyone! I have found a lot of help reading these forums (Google search results) and learned quite a bit. I am no expert and have an issue.
I have a workbook with several sheets that combine results into one final sheet - a purchase order. Since this sheet is dynamic and can include several rows, I created a "header" sheet and "footer" sheet. I would like to combine these now to one page as a PDF - the header, then main content sheet, then footer. So far, when I save to PDF using VBA, the header is on one page, then the main content on another page and the footer is on a 3rd page. Can they exist on one page?
Also, I wasn't sure how to set the page properties for the three sheets so I made 3 different "with" "End With" sections.
Thank you for your time and any help you can provide!
Mike
I have a workbook with several sheets that combine results into one final sheet - a purchase order. Since this sheet is dynamic and can include several rows, I created a "header" sheet and "footer" sheet. I would like to combine these now to one page as a PDF - the header, then main content sheet, then footer. So far, when I save to PDF using VBA, the header is on one page, then the main content on another page and the footer is on a 3rd page. Can they exist on one page?
Also, I wasn't sure how to set the page properties for the three sheets so I made 3 different "with" "End With" sections.
VBA Code:
Private Sub CmdSavePdf_Click()
Sheets(Array("WINPO_HDR", "WINPO", "WINPO_FOOTER")).Select
With Worksheets("WINPO_HDR")
.PageSetup.Orientation = xlLandscape
.PageSetup.Zoom = False
.PageSetup.FitToPagesTall = False
.PageSetup.FitToPagesWide = 1
End With
With Worksheets("WINPO")
.PageSetup.Orientation = xlLandscape
.PageSetup.Zoom = False
.PageSetup.FitToPagesTall = False
.PageSetup.FitToPagesWide = 1
End With
With Worksheets("WINPO_FOOTER")
.PageSetup.Orientation = xlLandscape
.PageSetup.Zoom = False
.PageSetup.FitToPagesTall = False
.PageSetup.FitToPagesWide = 1
End With
Dim FolderPath As String
FolderPath = "C:\PDF-Tests"
' MkDir FolderPath
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FolderPath & "\WINPO_TEST", _
openafterpublish:=False, ignoreprintareas:=False
End Sub
Thank you for your time and any help you can provide!
Mike