Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel main window close event

Can I somehow get a notification when the user tries to close the excel
application? Say, I just want to pop open a message box asking user if she
indeed wants to exit.

Thanks,
--Avs


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Excel main window close event

Avneesh.


I really would not recommend to do it cause it is annoying. Because I know I
want to close when I click the X button I dont like to be asked if I wanna
do it


either way if you still think is a good Idea or have a special project then
use this.


Private Sub Workbook_BeforeClose(Cancel As Boolean)

myans = MsgBox("Are you sure you wanna get out of here?", vbYesNo)
If myans = vbNo Then
Exit Sub
Else
Application.Quit
End If

End Sub

Regards,

Cesar Zapata


"Avneesh Saxena" wrote in message
...
Can I somehow get a notification when the user tries to close the excel
application? Say, I just want to pop open a message box asking user if she
indeed wants to exit.

Thanks,
--Avs




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel main window close event

Thanks! However, I don't want to trap workbook close events but I want to
trap the closing of the main window (which is obviously different).

lso, I'm not going to popup a dialog but I do want to make some programatic
changes, that was just the simplest way to put it :-).

Thanks,
--Avs

"Cesar Zapata" wrote in message
...
Avneesh.


I really would not recommend to do it cause it is annoying. Because I know

I
want to close when I click the X button I dont like to be asked if I wanna
do it


either way if you still think is a good Idea or have a special project

then
use this.


Private Sub Workbook_BeforeClose(Cancel As Boolean)

myans = MsgBox("Are you sure you wanna get out of here?", vbYesNo)
If myans = vbNo Then
Exit Sub
Else
Application.Quit
End If

End Sub

Regards,

Cesar Zapata


"Avneesh Saxena" wrote in message
...
Can I somehow get a notification when the user tries to close the excel
application? Say, I just want to pop open a message box asking user if

she
indeed wants to exit.

Thanks,
--Avs






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
Close Excel mac help window BillyC in Ross Excel Discussion (Misc queries) 0 August 5th 06 07:25 PM
Cannot maximize an existing workbook in the excel main window. jimmy Excel Discussion (Misc queries) 2 August 1st 06 04:52 AM
How can you close a window with the back button in excel Holly Williams Excel Discussion (Misc queries) 0 September 20th 05 01:57 PM
After Close Event? Don Wiss Excel Programming 2 November 19th 03 12:30 AM
Close explorer window from excel VBA Itzik[_2_] Excel Programming 0 October 1st 03 02:58 PM


All times are GMT +1. The time now is 05:36 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"