Partager via


GetInspector Property

Returns an Inspector object that represents an inspector initialized to contain the specified item. This property is useful for returning a new Inspector object in which to display the item, as opposed to using the ActiveInspector method and setting the CurrentItem property.

expression**.GetInspector**

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

This Visual Basic for Applications (VBA) example uses the GetInspector property to return a new, inactive inspector for myItem, and then toggles the AdaptiveMenus property.

Sub DisplayAdaptiveMenus()
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem
Dim myInspector As Outlook.Inspector
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myInspector = myItem.GetInspector
myInspector.CommandBars.AdaptiveMenus = Not myInspector.CommandBars.AdaptiveMenus
myInspector.Display
End Sub

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript code.

Set myItem = Application.CreateItem(0)
Set myInspector = myItem.GetInspector
myInspector.CommandBars.AdaptiveMenus = Not myInspector.CommandBars.AdaptiveMenus
myInspector.Display

Applies to | AppointmentItem Object | ContactItem Object | DistListItem Object | DocumentItem Object | JournalItem Object | MailItem Object | MeetingItem Object | NoteItem Object | PostItem Object | RemoteItem Object | ReportItem Object | TaskItem Object | TaskRequestAcceptItem Object | TaskRequestDeclineItem Object | TaskRequestItem Object | TaskRequestUpdateItem Object

See Also | ActiveInspector Method | Add Method | GetExplorer Method | Inspectors Property