Hi,
I have coded a button, so that when pressed it will generate a pdf of the combined print areas of the three pages on my spreadsheet. (I have made sure to set the print areas on each page). However, when pressing, it generates the pdf, but each print area does not stay on its own page (because the width is too big). I was just wondering what to add to the code to ensure each print area stays on its own page. Thanks.
Sub PrintPDF()
'turn off screen updating
Application.ScreenUpdating = False
'open dialog and set file type
Opendialog = Application.GetSaveAsFilename("", filefilter:="PDF Files (*.pdf), *.pdf", _
Title:="Test")
'if no value is added for file name
If Opendialog = False Then
MsgBox "The operation was not successful"
Exit Sub
End If
'create the pdf
On Error Resume Next
Sheets(Array("Entry", "Breakdown", "Summary")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Opendialog, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
'error handler
On Error GoTo 0
'clear the page breaks
ActiveSheet.DisplayPageBreaks = False
Application.ScreenUpdating = False
End Sub
Bookmarks