Explorer.Activate Method (Outlook)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

expression .Activate

expression A variable that represents an Explorer object.

This Microsoft 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 myOlExp As Outlook.Explorer 
 
Public Sub Initialize_handlers() 
 Set myOlExp = Application.ActiveExplorer 
End Sub 
 
Private Sub NewMail() 
 myOlExp.Activate 
End Sub
Show: