Deactivate Event

Occurs when an explorer or inspector stops being the active window, either as a result of user action or through program code. This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).


*object   * An expression that evaluates to an Explorer or Inspector object.


This Visual Basic for Applications (VBA) example uses the WindowState property to minimize the topmost explorer window when it is not active. 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 Microsoft Outlook.

Dim myOlApp As New Outlook.Application
Public WithEvents myOlExp As Outlook.Explorer

Public Sub Initialize_handler()
    Set myOlExp = myOlApp.ActiveExplorer
End Sub

Private Sub myOlExp_Deactivate()
    myOlExp.WindowState = olMinimized
End Sub

Applies to | Explorer Object | Inspector Object

See Also | Activate Method | Using events with Automation