Customizing the Navigation Pane
The Navigation Pane provides access to information that pertains to the active explorer, including different views and different ways to accomplish tasks in that explorer. The NavigationPane object represents the Navigation Pane for an explorer; to obtain one, call the NavigationPane property of the Explorer object. If the explorer does not contain a Navigation Pane, this property returns Null (Nothing in Visual Basic).
The Navigation Pane contains the set of navigation modules that are available in Outlook; for example, the Mail module. Each navigation module is represented by a NavigationModule object or by an object that is derived from the NavigationModule object. The Modules property of the NavigationPane object provides access to the navigation modules that are in the Navigation Pane. You can use the following objects to access the corresponding navigation module:
Note that the Solutions module is not displayed in the Navigation Pane by default, and can only be created programmatically. The default name of the module is Solutions, but you can customize that name.
Navigation Groups and Navigation Folders
Each navigation module contains a set of navigation groups. A navigation group, represented by the NavigationGroup object, is a container for navigation folders. A navigation folder, represented by the NavigationFolder object, provides an access point in the Navigation Pane for a Folder object. You can obtain a NavigationGroup object reference by using the NavigationGroups property of a CalendarModule, ContactsModule, JournalModule, MailModule, NotesModule, or TasksModule object. The Folder List, Shortcuts, and Solutions navigation modules do not contain navigation groups.
You can create and delete custom navigation groups by using the NavigationGroups.Create and NavigationGroups.Delete methods. You can identify a custom navigation group by using the NavigationGroup.GroupType property to retrieve the navigation group type for the object, and you can retrieve the default navigation group for a specified group type by using the NavigationGroups.GetDefaultNavigationGroup method.
Once you have a NavigationGroup object, you can obtain a NavigationFolder object reference by using the NavigationGroup.NavigationFolders property. Each NavigationFolder represents a navigation folder associated with a Folder object. You can add navigation folders to a navigation group by using the NavigationFolders.Add method. Only one NavigationFolder object can be associated with a Folder object at any given time, so adding a NavigationFolder that is associated with a given Folder object to a navigation group automatically removes any existing NavigationFolder references that are associated with that Folder object. You can also delete navigation folders from a navigation group by using the NavigationFolders.Remove method, but only if the NavigationFolders.IsRemovable property is set to True for the NavigationFolder object to be removed. You cannot remove standard navigation folders, such as the Inbox folder, that are defined by Outlook.
Note Navigation folders can be freely added or removed from the Favorite Folders navigation group, a special navigation group that is contained by the MailModule object, regardless of the IsRemovable property value of the navigation folder.
Displaying the Navigation Pane
The Navigation Pane can display navigation modules in either normal or collapsed mode. The Visible property of a NavigationModule object determines whether the navigation module is displayed in the Navigation Pane; the order that the visible navigation modules are displayed is determined by the Position property of each NavigationModule object.
You can use the IsCollapsed property to determine which mode the NavigationPane object uses. In normal mode, the visible navigation modules in the Navigation Pane are displayed as a combination of large and small buttons. The number of large buttons that are displayed in normal mode is determined by the DisplayedModuleCount property. If there are more visible navigation modules than are specified by this property, the remaining visible navigation modules are displayed as small buttons at the bottom of the Navigation Pane. In collapsed mode, the visible navigation modules in the Navigation Pane are displayed as small buttons. The number of small buttons displayed in collapsed mode is determined by the DisplayedModuleCount property. If there are more visible navigation modules than are specified by this property, the remaining visible navigation modules are not displayed.
To change the current navigation module, set the CurrentModule property of the NavigationPane object to one of the NavigationModule objects in the navigation pane.
In each navigation module, the NavigationGroup.Position property determines the display order of the navigation groups. Similarly, the NavigationFolder.Position property determines the display order of navigation folders within each navigation group. If a NavigationFolder object represents a calendar folder, the IsSideBySide property determines if the contents of the calendar folder are displayed in side-by-side or overlay mode.
Handling Navigation Pane Events
The NavigationPane object provides the ModuleSwitch event so that add-ins can identify when the current navigation module changes in the Navigation Pane, either programmatically or by user action.
The NavigationGroups object provides the NavigationFolderAdd and NavigationFolderRemove events so that add-ins can identify when a navigation folder is added or removed from a NavigationGroup object in the collection. The NavigationGroups object also provides the SelectedChange event. Add-ins use that event to identify when the IsSelected property of a navigation folder that is associated with a calendar folder changes in the Navigation Pane, either programmatically or by user action.
To detect a user change a folder in the Folder List, use the BeforeFolderSwitch and FolderSwitch events of the Explorer object. Similarly, to detect when the Solutions module is first displayed in the Navigation Pane, or to detect a user click a different folder in the Solutions module, use the BeforeFolderSwitch and FolderSwitch events.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.