tags:

views:

11

answers:

0

Software EXCEL 2003, 11.6560.6568, SP2.

I've created a "Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)" macro in a workbook to check that certain cells are populated before I allow the workbook to be saved. "Cancel" is set to true to prevent the workbook being saved when certain validation tests are failed.

In setup mode, ie when writing the macro code initially, I want the tests to be skipped (so that I can circulate a blank data-entry form) so I use the VBA "debug code" facility to skip over the tests. When the users access the workbook, they don't know about the embedded macro and they don't realise the tests can be skipped - crude by workable.

However sometimes after exiting the workbook I can't exit Excel as I get a popup message "Cannot Quit Microsoft Office Excel". I've encountered this several times but have yet to comnsistently recreate the steps exactly. I'd like to know how to prevent same or to deal with same via the macro code.