I am wondering if anyone has a code example ( yes, I used search but did not find what i am looking for).
I have created a spreadsheet, that has many worksheets. Each worksheet takes up 4 pages on the sheet.
I would like to create a userform that will list all sheets except the first three, then have checkboxes to
allow the user to select which pages to include in a single PDF file to be saved on the desktop.
I have been able to put together code that allows me to save everything to a single pdf, but I am not having
any luck with being able to select which sheets to print. Within that, I am only wanting to print the Top Left page
on each sheet, and the one below it. The other two have pricing information that should not be printed.
Here is the code I have used to print all pages of all sheets to pdf....im just looking to be able to select which in
a userform with checkboxes. Any help with how to modify for my needs will be appreciated.
[/B]
I have created a spreadsheet, that has many worksheets. Each worksheet takes up 4 pages on the sheet.
I would like to create a userform that will list all sheets except the first three, then have checkboxes to
allow the user to select which pages to include in a single PDF file to be saved on the desktop.
I have been able to put together code that allows me to save everything to a single pdf, but I am not having
any luck with being able to select which sheets to print. Within that, I am only wanting to print the Top Left page
on each sheet, and the one below it. The other two have pricing information that should not be printed.
Here is the code I have used to print all pages of all sheets to pdf....im just looking to be able to select which in
a userform with checkboxes. Any help with how to modify for my needs will be appreciated.
VBA Code:
[B]Public Sub Save_Sheets_As_PDF()
Dim PDFfile As String
Dim currentSheet As Worksheet
Dim i As Long
Dim replaceSelected As Boolean
PDFfile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & "S2 Services Retail Pricing" & Format(Now, " DD-MMM-YY") & ".pdf"
With ActiveWorkbook
Set currentSheet = .ActiveSheet
replaceSelected = True
MsgBox .Sheets("Labor Calculator").Index + 2 & " " & .Sheets.Count
For i = .Sheets("Labor Calculator").Index + 2 To .Sheets.Count
.Sheets(i).Select replaceSelected
replaceSelected = False
Next
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PDFfile, _
Quality:=xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
currentSheet.Select True
MsgBox "Created " & PDFfile
End With
End Sub