I have spreadsheets that we print to PDF via macro. The boss wants me to add a step that once the spreadsheet is printed to PDF it clears the contents.
I have created this but the ClearContents step needs debugging. Please help
Sub POSaveAs()
'
Dim strFilename As String
Const strPath As String = "F:\Timesheets\Approved Timesheets"
strFilename = Value & "EMP" & " - " & Range("J5") & " - " & Range("J2") & " - " & Replace(Range("A23").Value, "/", "-")
ChDrive "F:\Timesheets\Approved Timesheets"
ChDir strPath
Application.DisplayAlerts = False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFilename, IgnorePrintAreas:=False, OpenAfterPublish:=True
Application.DisplayAlerts = True
Range("C10:I23").ClearContents
End Sub
I have created this but the ClearContents step needs debugging. Please help
Sub POSaveAs()
'
Dim strFilename As String
Const strPath As String = "F:\Timesheets\Approved Timesheets"
strFilename = Value & "EMP" & " - " & Range("J5") & " - " & Range("J2") & " - " & Replace(Range("A23").Value, "/", "-")
ChDrive "F:\Timesheets\Approved Timesheets"
ChDir strPath
Application.DisplayAlerts = False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFilename, IgnorePrintAreas:=False, OpenAfterPublish:=True
Application.DisplayAlerts = True
Range("C10:I23").ClearContents
End Sub