共用方式為


Inspectors Property

Returns an Inspectors collection object that contains the Inspector objects representing all open inspectors.

expression.Inspectors

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

Example

This Microsoft Visual Basic example uses the Inspectors property and the Count property and Item method of the Inspectors object to display the captions of all inspector windows.

Private Sub CommandButton1_Click()
    Dim myOlApp As New Outlook.Application
    Dim myInspectors As Outlook.Inspectors
    Dim x as Integer
    Dim iCount As Integer
    Set myInspectors = myOlApp.Inspectors
    iCount = myOlApp.Inspectors.Count
    If iCount > 0 Then
        For x = 1 To iCount
            MsgBox myInspectors.Item(x).Caption
        Next x
    Else
        MsgBox "No inspector windows are open."
    End If
End Sub

   

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

Sub CommandButton1_Click()
    Dim x
    iCount = Application.Inspectors.Count
    Set myInspectors = Application.Inspectors
    If iCount > 0 Then
        For x = 1 To iCount
            MsgBox myInspectors.Item(x).Caption
        Next
    Else
        MsgBox "No Inspector windows are open."
    End If
End Sub

Applies to | Application Object

See Also | ActiveInspector Method | GetInspector Property