ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting Cancel = True in WorkbookBeforePrint (https://www.excelbanter.com/excel-programming/285978-setting-cancel-%3D-true-workbookbeforeprint.html)

Tony

Setting Cancel = True in WorkbookBeforePrint
 
A problem occurs when running some data validation checks
in the WorkbookBeforePrint Event.

If checks throw up erroneous data I set Cancel = True (to
cancel the print) and my code jumps to the point in the
wookbook where the error occurs.

If the error is on the activeworksheet everything is
fine, however if the error is on another sheet,
attempting to activate it and the cell where the error is
causes Excel to present the hourglass cursor and nothing
seems to happen (although the sheet is displayed).
Clicking in this sheet causes cursor to move in a random
fashion. To correct this the user must click another
sheet or window and return to the sheet containing the
error - the cursor then behaves normally.

Also the cell address textbox in toolbar gives a cell
reference corresponding to where the user was when he
tried to print i.e. the cell in the original worksheet.
It is as if the program thinks it is still on the orginal
worksheet (although the error sheet was activated
properly and is now displayed).

Any solution to this problem would be greatly appreciated.

Tony
PS I am using XP SP2


All times are GMT +1. The time now is 03:35 AM.

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