CurrentFolder Property Example

This Visual Basic for Applications example uses the CurrentFolder property to change the displayed folder to the user's Calendar folder.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myOlApp.ActiveExplorer.CurrentFolder = _
    myNameSpace.GetDefaultFolder(olFolderCalendar)

If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.

Set myNameSpace = Application.GetNameSpace("MAPI")
Set Application.ActiveExplorer.CurrentFolder = _
    myNameSpace.GetDefaultFolder(9)