Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
beforeclose placement | Excel Discussion (Misc queries) | |||
beforesave and beforeclose | Excel Programming | |||
BeforeClose vs Auto_Close | Excel Programming | |||
problem with beforeclose event | Excel Programming | |||
Excel - BeforeClose Problem... | Excel Programming |