SelectFolder Method

Displays the folder if it can be displayed simultaneously with the current folder in the explorer. Otherwise, the explorer switches to the specified folder.


*expression   * Required. An expression that returns one of the objects in the Applies To list.

*MAPIFolder   * Required. The MAPIFolder object representing the folder to be displayed in the explorer.


You can display multiple calendars simultaneously using this method.


This Microsoft Visual Basic for Applications (VBA) example displays a shared calendar simultaneously with the current user's default Calendar folder. To run this example without errors, replace Dan Wilson with a valid recipient name whose Calendar is shared and whose calendar you have permissions to view.

Sub DispCalendars()
    Dim myOlApp As Outlook.Application
    Dim myNms As Outlook.NameSpace
    Dim myFolder As Outlook.MAPIFolder
    Dim myRecipient As Outlook.Recipient
    Dim myExplorer As Outlook.Explorer
    Dim SharedFolder As Outlook.MAPIFolder
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNms = myOlApp.GetNamespace("MAPI")
    Set myFolder = myNms.GetDefaultFolder(olFolderCalendar)
    Set myExplorer = myOlApp.ActiveExplorer
    Set myExplorer.CurrentFolder = myFolder
    Set myRecipient = myNms.CreateRecipient("Dan Wilson")
    Set SharedFolder = myNms.GetSharedDefaultFolder(myRecipient, olFolderCalendar)
    myExplorer.SelectFolder SharedFolder
End Sub

Applies to | Explorer Object