LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default beforeclose cancel not working

Hey,

I am having a problem with a workbook... I'm using excel 2003 sp3 on
WinXP version 2002 SP3.


I cannot cancel a workbook close event, as I believe I should, by
setting 'Cancel' to true. I have code something akin to this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Me.Saved = False Then
ClearToSave
Select Case MsgBox("Do you want to save the changes you made
to '" & Me.Name & "'", vbYesNoCancel + vbExclamation, "Microsoft Excel!
ent")
Case vbYes
.....
Case vbNo
.....
Case vbCancel
UpdateMSC
Cancel = True
End Select
End If
End Sub



before I added the sendkeys, I also tried creating an class module and
putting similar code in the class events, etc, setting that up
correctly. Both versions of the code work flawlessly EXCEPT that I
get a second "Do you want to save Yes / No / Cancel" . If I have both
the workbook event and the class module running the same code, I can
even see in the class module code that cancel is now TRUE (assuming I
hit cancel with my first Y/N/C messagebox)


What is the problem? I've seen tonnes of old posts on this but can't
find the solution.
 
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
Sub Workbook_Open and BeforeClose not working Dorothy Excel Programming 2 February 28th 08 08:45 PM
Workbook_BeforeClose - Cancel not working sebt Excel Programming 0 January 31st 06 04:36 PM
BeforeDoubleClick Cancel=True not working Reggie Excel Programming 1 September 20th 05 03:43 AM
Cancel Macro is user selects 'cancel' at save menu Mark Excel Programming 1 April 6th 05 05:45 PM
Close workbook with "Cancel=TRUE" in the BeforeClose()" Wellie[_3_] Excel Programming 1 October 16th 04 09:46 PM


All times are GMT +1. The time now is 05:17 AM.

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

About Us

"It's about Microsoft Excel"