Turpis
Programmer
- Apr 16, 2002
- 151
Is there such a thing as a beforeclose event in Outlook?
I program in Excel quite a bit and if I wanted to have Excel prompt me to confirm if I really wanted to close Excel or not I would put in the following code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ans = MsgBox("Are you sure you want to exit?", vbYesNo, _
"Close Application?"
If ans = vbNo Then
Cancel = True
End If
End Sub
I put this code into the Application_Quit event in Oulook and Outlook quits first and then asks the msgbox question. How can I create a beforeclose event?
Charles
Well I want to do this to my Outlook because I open and close many files all day long and I have a five button Microsoft trackball with one of the buttons program to close active application. Sometimes (about 3-4 times a week) I accidentally end up closing Outlook and it is starting to really get me mad.
I program in Excel quite a bit and if I wanted to have Excel prompt me to confirm if I really wanted to close Excel or not I would put in the following code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ans = MsgBox("Are you sure you want to exit?", vbYesNo, _
"Close Application?"
If ans = vbNo Then
Cancel = True
End If
End Sub
I put this code into the Application_Quit event in Oulook and Outlook quits first and then asks the msgbox question. How can I create a beforeclose event?
Charles
Well I want to do this to my Outlook because I open and close many files all day long and I have a five button Microsoft trackball with one of the buttons program to close active application. Sometimes (about 3-4 times a week) I accidentally end up closing Outlook and it is starting to really get me mad.