ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Messgae Box on Exit Application (https://www.excelbanter.com/excel-programming/279537-messgae-box-exit-application.html)

patterson_m[_5_]

Messgae Box on Exit Application
 
I want to display a message box when the user 'exits' the application.

Sub Auto_close ()

MsgBox "THANK YOU FOR YOUR FEEDBACK ", vbOKOnly + vbInformation,
"From the Agreement Finance Team"

Application.Quit

End Sub


The problem is that the message box appears twice, each time prompting
the user to click ok.

Any ideas why or how I can stop this.

Thanks

Mark



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Harald Staff

Messgae Box on Exit Application
 
Hi Mark

Get rid of "Application.Quit" in the code and see if it helps. Aplication does not refer
to your app but to Excel herself. Also, you should not use MsgBoxes for things like those,
MsgBoxes require an OK click and if no click then Excel won't close and then Windows won't
close and my laptop runs out of batteries or you won't be in time for dinner or ... You
don't want your team's name on a monster like that.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"patterson_m" wrote in message
...
I want to display a message box when the user 'exits' the application.

Sub Auto_close ()

MsgBox "THANK YOU FOR YOUR FEEDBACK ", vbOKOnly + vbInformation,
"From the Agreement Finance Team"

Application.Quit

End Sub


The problem is that the message box appears twice, each time prompting
the user to click ok.

Any ideas why or how I can stop this.

Thanks

Mark



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com