Hi all,
I am stuck for the last few weeks with this issue. I like to output a PDF with multiple sheets but with one of them only output its selected ranges. The reason behind the selected ranges, is because I have certain sections that will be hidden (it depends on what the user had inputted previously, so the visibility of each section can change) and each section has its own page breaks so it will look professional when output. The issue comes in is when we simply output the sectioned sheet along with other sheets, it will create a blank page for each hidden section. If selection is used, only the selected range (in this case visible cells) gets output so no blank pages will be produced. The tricky part is, how to code it? The code below works fine for multiple sheets, but again it will produce those blank pages which I am trying to avoid.
Sheets(Array("Sheet1", "Sheet1", "Sheet1")).Select
'Generate the PDF, based on the selected sheets selected
FileFormatstr = "PDF Files (*.pdf), *.pdf"
Fname = Application.GetSaveAsFilename("", filefilter:=FileFormatstr, Title:="Create PDF")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fname, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
Thanks!
Bookmarks