Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook-Close StopTimer event Stonewall Rubberbow Excel Discussion (Misc queries) 2 January 12th 08 11:06 PM
Close workbook with "Cancel=TRUE" in the BeforeClose()" Wellie[_3_] Excel Programming 1 October 16th 04 09:46 PM
Input Box Cancel Event Craig[_20_] Excel Programming 3 September 7th 04 10:21 AM
Workbook Close Event Stefano Condotta Excel Programming 1 June 16th 04 10:44 PM
Clear Clipboard on Workbook Close Event (Excel XP) Culichi Excel Programming 2 February 23rd 04 06:21 PM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"