共用方式為


ActiveInspector Method

Returns the topmost Inspector object on the desktop. If no inspector is active, returns Nothing. Use this method to access the Inspector object that the user is most likely to be viewing.

expression**.ActiveInspector**

*expression   * Required. An expression that returns an Application object

Remarks

If you are using Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you should typically use the GetInspector method to refer to the Inspector object associated with the form, for example:

Set myInspector = Item.GetInspector

Example

This Visual Basic for Applications (VBA) example uses the ActiveInspector method to obtain the currently active Inspector object and enables the display of keys in ToolTips in the inspector.

Sub DisplayKeys()
'Enables key in ToolTips
    Dim myolapp As Outlook.Application
    Dim myinspector As Outlook.Inspector
    Set myolapp = CreateObject("Outlook.Application")
    Set myinspector = myolapp.ActiveInspector

    'Test if an inspector is active
    If Not TypeName(myinspector) = "Nothing" Then
          myinspector.CommandBars.DisplayKeysInTooltips = True
    End If

End Sub

Applies to | Application Object

See Also | ActiveExplorer Method | ActiveWindow Method | GetInspector Property | Inspectors Property