ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use code to cancel printing (https://www.excelbanter.com/excel-programming/281097-use-code-cancel-printing.html)

Jim [email protected]

Use code to cancel printing
 
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


Bob Umlas[_3_]

Use code to cancel printing
 
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

"Jim " wrote
in message ...
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





All times are GMT +1. The time now is 01:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com