Hi All, I have a sheet where I would like to be able to print to PDF using a control button however it seems to bug out after the End With. I can post the original document due to workplace security unfortunately. Heres the code, any suggestions?
Sub MakePDF()
Dim strFilename As String
Dim rngRange As Range
Set rngRange = Worksheets("Planned Time").Range("A42")
strFilename = rngRange.Value
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PrintArea = "$A$1:$P$33"
.PrintTitleRows = ActiveSheet.Rows(5).Address
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
End With
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False, _
From:=1, _
To:=5, _
OpenAfterPublish:=True
End Sub
Thanks in advance
Sub MakePDF()
Dim strFilename As String
Dim rngRange As Range
Set rngRange = Worksheets("Planned Time").Range("A42")
strFilename = rngRange.Value
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PrintArea = "$A$1:$P$33"
.PrintTitleRows = ActiveSheet.Rows(5).Address
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
End With
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False, _
From:=1, _
To:=5, _
OpenAfterPublish:=True
End Sub
Thanks in advance