Explorers Property
Returns an Explorers collection object that contains the Explorer objects representing all open explorers.
expression.Explorers
*expression * Required. An expression that returns an Application object.
Example
The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example displays the number of explorer windows that are open.
Dim myOlApp As New Outlook.Application
Private Sub CountExplorers()
MsgBox "There are " & _
myOlApp.Explorers.Count & " Explorers."
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.
Sub CommandButton1_Click()
MsgBox "There are " & _
Application.Explorers.Count & " Explorers."
End Sub
The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example uses the Count property and Item method of the Selection collection returned by the Selection property to display the senders of all mail items selected in the explorer that displays the Inbox. To run this example, you need to have at least one mail item selected in the explorer displaying the Inbox.
Note You might receive an error if you select items other than a mail item such as task request as the SenderName property does not exist for a TaskRequestItem object.
Sub GetSelectedItems()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim MsgTxt As String
Dim x As Integer
MsgTxt = "You have selected items from: "
Set myOlExp = myOlApp.Explorers.Item(1)
If myOlExp = "Inbox" Then
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.Count
MsgTxt = MsgTxt & myOlSel.Item(x).SenderName & ";"
Next x
MsgBox MsgTxt
End If
End Sub
Applies to | Application Object
See Also | ActiveExplorer Method | GetExplorer Method