MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Excel VBA Events: Print?


Posted by Charles Marshall on July 05, 2001 1:18 PM

Is Print an Excel VBA Event?

I would like to validate some data when the user clicks print. If the validation passes, then the print should occurr, otherwise it should warn for data entry errors.

Any ideas? Print Event? Other tactic?

Thanks all.


Posted by Russell on July 05, 2001 2:27 PM

Yes, go to the VBA editor, and in the Project Explorer, double click on "This Workbook". Then in the pulldown that says (General) above where your code goes, select Workbook. Then in the right pulldown (next to the one that said (General), select BeforePrint. Put your code in there that checks, and if you don't want them to be able to print, then set Cancel to True.

Hope this helps,

Russell