Explorers Property Example

The following Microsoft Visual Basic example displays the number of explorer windows that are open.

Dim myOlApp As New Outlook.Application
Private Sub Command1_Click()
    MsgBox "There are " & _
         myOlApp.Explorers.Count & " Explorers."
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.

Sub CommandButton1_Click()
    MsgBox "There are " & _
        Application.Explorers.Count & " Explorers."
End Sub