Inspectors Property

Microsoft Outlook Visual Basic

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.

Dim myOlApp As New Outlook.Application
Private Sub Command1_Click()
    If myOlApp.Inspectors.Count > 0 Then
        For x = 1 To myOlApp.Inspectors.Count
            MsgBox Inspectors.Item(x).Caption
        Next x
    Else
        MsgBox "There are no inspector windows open."
    End If
End Sub

    

If you use VBScript, you do not declare an Application object variable. This example shows how to perform the same task using VBScript.

Private Sub Command1_Click()
    If Application.Inspectors.Count > 0 Then
        For x = 1 To myOlApp.Inspectors.Count
            MsgBox Inspectors.Item(x).Caption
        Next x
    Else
        MsgBox "There are no inspector windows open."
    End If
End Sub