ActiveInspector Method Example

ActiveInspector Method Example

This Visual Basic for Applications example uses the ActiveInspector method to demonstrate how to obtain the currently active Inspector object and display the name of the item that the inspector is displaying.

Set myOlApp = CreateObject("Outlook.Application")
Set myInspector = myOlApp.ActiveInspector
MsgBox "The active item is " & myInspector.CurrentItem.Subject

If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.

Set myInspector = Application.ActiveInspector
MsgBox "The active item is " & myInspector.CurrentItem.Subject