ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Hi,
Code supplied below but when i run it to save as a pdf file the line shown below in in yellow.
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True
Code supplied below but when i run it to save as a pdf file the line shown below in in yellow.
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True
Code:
Private Sub GrassSummarySheet_Click() Dim strFileName As String
strFileName = "C:\Users\Ian\Desktop\GRASS CUTTING\CURRENT GRASS SHEETS\SUMMARY 2019-2020\" & Range("L3") & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "GRASS SUMMMARY SHEET " & Range("L3") & " WAS NOT SAVED AS IT ALREADY EXISTS", vbCritical + vbOKOnly, "GRASS SUMMARY SHEET MESSAGE"
Exit Sub
End If
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True
MsgBox "GRASS SUMMARY SHEET " & Range("L3") & " WAS SAVED SUCCESSFULLY", vbInformation + vbOKOnly, "GRASS SUMMARY SHEET MESSAGE"
Range("D5:E17,D21:D33").ClearContents
Range("D5").Select
ActiveWorkbook.Save
End With
End Sub