Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default BeforeClose Problem

Hi everyone,
I could use some help finding a proper alternative to BeforeClose.

As I've read in other threads it is known to cause problem and so it
does for me as well (the whole application crashing for example).

The problem is that I need to catch the event caused by a user clicking
the [x] to close a wb. I'm saving some data to DB and need to prompt
the user some alternatives when closing (yes/no/cancel), ie I need to
catch 'cancel', this is why I can't use Auto_Close...

I hope any of you people can help me!

Thanks!
/Anders

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default BeforeClose Problem

ie I need to catch 'cancel', this is why I can't use Auto_Close...

I think you can use Before_Close if I'm following you. For example:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Resp As Integer
Resp = MsgBox("Save data?", vbYesNoCancel)
Select Case Resp
Case vbCancel
Cancel = True
Case vbYes
''do save...
Case vbNo
''do whatever
End Select
End Sub



--
Jim
wrote in message
oups.com...
| Hi everyone,
| I could use some help finding a proper alternative to BeforeClose.
|
| As I've read in other threads it is known to cause problem and so it
| does for me as well (the whole application crashing for example).
|
| The problem is that I need to catch the event caused by a user clicking
| the [x] to close a wb. I'm saving some data to DB and need to prompt
| the user some alternatives when closing (yes/no/cancel), ie I need to
| catch 'cancel', this is why I can't use Auto_Close...
|
| I hope any of you people can help me!
|
| Thanks!
| /Anders
|


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
beforeclose placement Curt Excel Discussion (Misc queries) 9 August 27th 07 08:00 PM
beforesave and beforeclose Adam Harding Excel Programming 2 July 25th 05 11:11 AM
BeforeClose vs Auto_Close [email protected] Excel Programming 16 June 3rd 05 10:06 PM
problem with beforeclose event Gordon Excel Programming 1 September 30th 04 11:21 PM
Excel - BeforeClose Problem... Al Mackay Excel Programming 0 September 22nd 03 12:26 PM


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

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"