Sub CreatePDF()
'
' PDF generating Macro
'
'
On Error GoTo CreatePDFErr
Dim strTheFileSaveName As String
strTheFileSaveName = Application.GetSaveAsFilename(InitialFileName:="My_" & ActiveWorkbook.Name, _
filefilter:="PDF (Adobe PDF) (*.pdf), *.Pdf", Title:="Please enter PDF filename to export to")
If strTheFileSaveName = "False" Then
MsgBox "PDF creation aborted no file will be produced ", , "Pdf Creation"
Exit Sub
End If
Application.ScreenUpdating = False
Sheets("pdf").Visible = True
Sheets("pdf").Select
Range("B3:E33").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strTheFileSaveName, _
Quality:=xlQualityMinimum, IncludeDocProperties:=False, IgnorePrintAreas:=True, OpenAfterPublish:=False
gblstrPDFName = strTheFileSaveName
Application.ScreenUpdating = True
Exit Sub
CreateTPDFErr:
MsgBox "Error returned from PDF creation. " & vbNewLine & "Error is : " & Str(Err) & " " & Error & vbNewLine & "Please Contact your support Staff with this Information", , "PDF Creation"
Application.ScreenUpdating = True
Exit Sub
End Sub