Workbook Before Close Event Cancel flag not functional(?)
I am attempting to use the before close event in VBA to perform some data
integrity checks, however the Cancel variable which is supposed to abort the workbook close event does not seem to be functioning as intended. I created a simple test (blank workbook, no other VBA except what is shown below) to try this out and again it failed. Debugging, it appears that the variable is indeed being set to correctly however setting it to true or false does not cause the close event to cancel. Since I've used this code before, I'm wondering if this is a bug or I just woke up too early this morning. My version info is Excel 2003 (11.6355.6360) SP1, VBA Retail 6.4.9972. Private Sub Workbook_BeforeClose(Cancel As Boolean) MsgBox("No you can't.") Cancel = True End Sub |
All times are GMT +1. The time now is 03:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com