Hi Guys,
In need of some assistance! I have a document which is 7 pages. The rows which make up pages 2-7 are hidden as default. Page one is a cover page and will not change.
Pages 2-7 are linked to individual AxtiveX control boxes. So, when a check box is selected the corresponding page will become un-hidden. For example when check box three is checked page three will appear (ie. go from hidden to un-hidden).
I'd like to create a VBA which saves the pages which are visible to the user to pdf. So for example, if the user selects checkbox 2,5,6 - those pages plus the cover page will create a four page pdf document.
My current code is below:
Sub Printsave()
Dim Folder As String
Dim Name As String
Dim Path As String
Dim zone_impression
Folder = ThisWorkbook.Path & "\"
Name = ActiveSheet.Range("G3").Value
Path = Folder & Application.PathSeparator & Name & " - Client Checklist.pdf"
zone_impression = "A1:N172" 'i'd like the range to only be the cells visible to the user (which is created from the check box slections they have made)
Range(zone_impression).ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=True, OpenAfterPublish:=True
End Sub
Everything works well apart but when saving to pdf it will create a document with lots of blank pages in between the pages visible to the user from the excel screen.
Are you able to create a pdf document from multiple cell ranges from excel? can anyone help?
Thanks in advance!
In need of some assistance! I have a document which is 7 pages. The rows which make up pages 2-7 are hidden as default. Page one is a cover page and will not change.
Pages 2-7 are linked to individual AxtiveX control boxes. So, when a check box is selected the corresponding page will become un-hidden. For example when check box three is checked page three will appear (ie. go from hidden to un-hidden).
I'd like to create a VBA which saves the pages which are visible to the user to pdf. So for example, if the user selects checkbox 2,5,6 - those pages plus the cover page will create a four page pdf document.
My current code is below:
Sub Printsave()
Dim Folder As String
Dim Name As String
Dim Path As String
Dim zone_impression
Folder = ThisWorkbook.Path & "\"
Name = ActiveSheet.Range("G3").Value
Path = Folder & Application.PathSeparator & Name & " - Client Checklist.pdf"
zone_impression = "A1:N172" 'i'd like the range to only be the cells visible to the user (which is created from the check box slections they have made)
Range(zone_impression).ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=True, OpenAfterPublish:=True
End Sub
Everything works well apart but when saving to pdf it will create a document with lots of blank pages in between the pages visible to the user from the excel screen.
Are you able to create a pdf document from multiple cell ranges from excel? can anyone help?
Thanks in advance!