Application.ActiveInspector 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.

Returns the topmost Inspector object on the desktop.

expression .ActiveInspector

expression A variable that represents an Application object.

Return Value

An Inspector that represents the topmost inspector on the desktop.

Use this method to access the Inspector object that the user is most likely to be viewing.

If no inspector is active, returns Nothing.

This Visual Basic for Applications (VBA) example uses the ActiveInspector method to obtain the currently active Inspector object. The example saves and closes the item displayed in the active inspector without prompting the user. To run this example, you need to have an item displayed in an inspector window.

Sub CloseItem() 
 
 Dim myinspector As Outlook.Inspector 
 
 Dim myItem As Outlook.MailItem 
 
 
 
 Set myinspector = Application.ActiveInspector 
 
 Set myItem = myinspector.CurrentItem 
 
 myItem.Close olSave 
 
End Sub 
 

Show: