Inspectors.Add method (Outlook)

Creates a new inspector window.

Syntax

expression.Add _Item_

expression A variable that represents an Inspectors object.

Parameters

Name Required/Optional Data type Description
Item Required Object The item to display in the inspector window when it is created.

Return value

An Inspector object that represents a new inspector window.

Remarks

This method is essentially identical to the GetInspector property of an Outlook item, such as MailItem.

Example

This Microsoft Visual Basic for Applications (VBA) example prompts the user for a company name, uses the Restrict method to locate all contact items in the Contacts folder with that name, and displays each one.

Sub DisplayMyContacts() 
 
 Dim myFolder As Folder 
 
 Dim myItems As Items 
 
 Dim myRestrictItems As Items 
 
 Dim answer As String 
 
 Dim filter As String 
 
 Dim myInspector As Inspector 
 
 Dim x As Integer 
 
 
 
 answer = InputBox("Enter the company name") 
 
 Set myFolder = Application.GetNamespace("MAPI") _ 
 
 .GetDefaultFolder(olFolderContacts) 
 
 filter = "[MessageClass] = 'IPM.Contact' AND [CompanyName] = '" & answer & "'" 
 
 
 
 Set myItems = myFolder.Items 
 
 Set myRestrictItems = myItems.Restrict(filter) 
 
 For x = 1 To myRestrictItems.Count 
 
 Set myInspector = Application.Inspectors.Add(myRestrictItems.Item(x)) 
 
 myInspector.Display 
 
 Next x 
 
End Sub

See also

Inspectors 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.