Activate Event

Microsoft Outlook Visual Basic

Occurs when an explorer or inspector becomes the active window, either as a result of user action or through program code. This event is not available in VBScript.

Sub object_Activate()

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

Example

This code example uses the WindowState property to maximize the topmost explorer window when the Activate event occurs. 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_Activate()
    If myOlExp.WindowState = olNormalWindow Then _
        myOlExp.WindowState = olMaximized
End Sub