Application.ActiveInspector method (Outlook)

Returns the topmost Inspector object on the desktop.

Syntax

expression. ActiveInspector

expression A variable that represents an Application object.

Return value

An Inspector that represents the topmost inspector on the desktop.

Remarks

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

If no inspector is active, returns Nothing.

Example

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

See also

Application Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.