Activate Method

Microsoft Outlook Visual Basic

Activates an explorer or inspector window by bringing it to the foreground and setting keyboard focus.

expression.Activate

expression Required. An expression that returns an Explorer or Inspector object.

Example

This Microsoft Visual Basic/Visual Basic for Applications example responds to the NewMail event by activating the explorer window. The sample code must be placed in a class module, and the Initialize_handlers routine must be called before the event procedure can be called by Microsoft Outlook.

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

Public Sub Initialize_handlers()
    Set myOlApp = CreateObject("Outlook.Application")
    Set myOlExp = myOlApp.ActiveExplorer
End Sub

Private Sub myOlApp_NewMail()
    myOlExp.Activate
End Sub