Quit Event

Microsoft Outlook Visual Basic

Quit Event

       

Occurs when Microsoft Outlook begins to close. This event is not available in VBScript.

Sub object_Quit()

object   An expression that evaluates to an Application object.

Example

This example displays a farewell message when Microsoft Outlook exits. The sample code must be placed in a class module, and the Initialize_handler routine must be called before the event procedure can be called by Outlook.

Dim WithEvents myOlApp As Outlook.Application

Sub Initialize_handler()
    Set myOlApp = CreateObject("Outlook.application")
End Sub

Private Sub myOlApp_Quit()
    MsgBox "Goodbye, " & Application.GetNamespace("MAPI").CurrentUser
End Sub