CurrentFolder Property

Microsoft Outlook Visual Basic

Returns or sets a MAPIFolder object that represents the current folder displayed in the explorer. Use this property to change the folder the user is viewing.

expression.CurrentFolder

expression     Required. An expression that returns an Explorer object.

Example

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

Sub ChangeCurrentFolder()
	Dim myolApp As Outlook.Application
	Dim myNamespace As Outlook.NameSpace
	Set myolApp = CreateObject("Outlook.Application")
	Set myNamespace = myolApp.GetNamespace("MAPI")
	Set myolApp.ActiveExplorer.CurrentFolder = _
	myNamespace.GetDefaultFolder(olFolderCalendar)
End Sub
		

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript code.

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