Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Application.ActiveExplorer Method

Office 2007
Returns the topmost Explorer object on the desktop.

Syntax

expression.ActiveExplorer

expression   A variable that represents an Application object.

Return Value
An Explorer that represents the topmost explorer on the desktop. Returns Nothing if no explorer is active.

Remarks

Use this method to return the Explorer object that the user is most likely viewing. This method is also useful for determining when there is no active explorer, so a new one can be opened.

Example

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 active explorer window. To run this example, you need to have at least one mail item selected in the active Explorer window.

Bb219876.vs_note(en-us,office.12).gif  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.
Visual Basic for Applications
Sub GetSelectedItems()
    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 = Application.ActiveExplorer
    Set myOlSel = myOlExp.Selection
    For x = 1 To myOlSel.Count
        MsgTxt = MsgTxt & myOlSel.Item(x).SenderName & ";"
    Next x
    MsgBox MsgTxt
End Sub



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.