Hi
I have a workbook that contains multiple sheets. we have on the road engineers that use these workbooks for complete inspections.
There are x amount of inspection worksheets
there is a summary page
there is a title page
I currently have a Create PDF button, using the code below that creates a pdf of only inspection sheets that have been completed.
This works perfectly
However, our admin people in the office also create a PDF for management, that contains the summary and title page. They dont use the button for this, they use print to PDF option instead.
The problem I am having is that we use the "Fit all rows on one page" to create this PDF, and for the inspection sheets this is fine, however the summary and title page span multiple pages at normal size, but to make all rows fit one page it obviously compresses the pages and they look terrible
So my question is, can I expand on this button above so I can pdf all the inspection sheets as they are, but also so add the summary page and title page without the fit to one page option?
I have a workbook that contains multiple sheets. we have on the road engineers that use these workbooks for complete inspections.
There are x amount of inspection worksheets
there is a summary page
there is a title page
I currently have a Create PDF button, using the code below that creates a pdf of only inspection sheets that have been completed.
VBA Code:
Sub Button12_Click()
Dim ws As Worksheet
Dim strWS As String
Dim strFolder As String
Dim varRet As Variant
Const cstrDel As String = ","
'getting information about the sheets that begin with "DPU Report"
For Each ws In Worksheets
If Left(ws.Name, 10) = "DPU Report" And ws.Range("C6").Value <> "" Then
strWS = strWS & ws.Name & cstrDel
End If
Next ws
'getting the folder to which to save to
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = -1 Then
strFolder = .SelectedItems(1) & "\"
Else
Exit Sub
End If
End With
'getting the filename to save
varRet = Application.GetSaveAsFilename(InitialFileName:=strFolder, _
fileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Save Report to Directory")
'if Cancel is chosen varRet will return False
If varRet <> False Then
'group the worksheets
Worksheets(Split(Left(strWS, Len(strWS) - 1), cstrDel)).Select
'print to PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=varRet, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True 'display after creation?
End If
End Sub
This works perfectly
However, our admin people in the office also create a PDF for management, that contains the summary and title page. They dont use the button for this, they use print to PDF option instead.
The problem I am having is that we use the "Fit all rows on one page" to create this PDF, and for the inspection sheets this is fine, however the summary and title page span multiple pages at normal size, but to make all rows fit one page it obviously compresses the pages and they look terrible
So my question is, can I expand on this button above so I can pdf all the inspection sheets as they are, but also so add the summary page and title page without the fit to one page option?