This works
add a first line to Sub SaveQuoteAsPDF
Sheets("Sheet1").Range("A10") - change this to whichever cell and sheet works for you
Sheets("Sheet1").Range("A10") = "PRINT PDF"
then amend the BeforePrint as follows (remember to reset that cell back to blank within the If...End if)
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Sheets("Sheet1").Range("A10") = "PRINT PDF" Then
Sheets("Sheet1").Range("A10") = ""
Exit Sub
End If
Cancel = True
MsgBox "You can't print this workbook"
End Sub
This adds as a switch.
If the cell contains the value "Print PDF" then it allows printing
Otherwise if cell is blank, no printing allowed
Bookmarks