Use code to cancel printing

  • Thread starter Thread starter Jim JTunks
  • Start date Start date
J

Jim JTunks

We use spreadsheets with week ending dates, but many users
forget to change the date. This leads to a lot of
reprinting. I would like to use a message box with
vbYesNo, Yes would allow the spreadsheet to print, No
would cancel the print.
Any ideas?
Thanks,
JT
 
Put code in the workbook_beforeprint event -- you can do something like:
Private Sub Workbook_BeforePrint(Cancel as Boolean)
if Msgbox(Did you change the date?",vbyesno+vbquestion)=vbno then
msgbox "Please do so, then try again.",vbexclamation
cancel=true
end if
End Sub

Bob Umlas
Excel MVP
 
Back
Top