Good Afternoon!
I have a spreadsheet which gets updated often, and some sheets go to some people, others go to different people - al at different times.
I would like to be able to select which sheets to print each time via check boxes in a userform (or a similar method) without having to print
every page of every sheet.
I have been able to find vba code that exports all of the sheets to a single pdf which is great.... but I am struggling to figure out how to
implement a userform to select which sheets i am going to export each time.
The code that I am using is below.....can anyone please assist me with figuring out how to accomplish what I am trying to do?
Public Sub Save_Sheets_As_PDF()
Dim PDFfile As String
Dim currentSheet As Worksheet
Dim I As Long
Dim replaceSelected As Boolean
Dim WS_Count As Integer
Dim II As Integer
PDFfile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & "Flat Rate Pricing Book" & Format(Now, " DD-MMM-YY") & ".pdf"
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For II = 1 To WS_Count
' Insert your code here.
' The following line shows how to reference a sheet within
' the loop by displaying the worksheet name in a dialog box.
MsgBox ActiveWorkbook.Worksheets(II).Name
Next II
With ActiveWorkbook
Set currentSheet = .ActiveSheet
replaceSelected = True
MsgBox .Sheets("Labor Calculator").Index + 2 & " " & .Sheets.Count
For II = .Sheets("Labor Calculator").Index + 2 To .Sheets.Count
.Sheets(II).Select replaceSelected
replaceSelected = False
Next
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PDFfile, _
quality:=xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
currentSheet.Select True
MsgBox "Your Price FIle Has Been Saved To Your Desktop! Go Sell Service!" & PDFfile
End With
End Sub
Bookmarks