How to: Set a Module as the Currently Selected Module in the Navigation Pane
Outlook Developer Reference |
You can use the CurrentModule property of the NavigationPane object in Microsoft Office Outlook 2007 to set a NavigationModule object as the currently selected navigation module in the Navigation Pane of an Explorer object.
The following sample sets the Calendar navigation module as the currently selected navigation module if the Journal navigation module is selected, either programmatically or by user action, in the Navigation Pane. The sample performs the following actions:
- The sample first obtains a reference to the NavigationPane object for the active explorer when the Startup event of the Application object is raised and assigns it to
objPane
, so the ModuleSwitch event of the NavigationPane object can be detected. - When the ModuleSwitch event of the NavigationPane occurs, the sample then checks if the current navigation module has changed by comparing the contents of the CurrentModule parameter of the ModuleSwitch event against the CurrentModule property of the NavigationPane object.
- If these object references are different, the sample then checks the NavigationModuleType property of the NavigationModule object reference in the CurrentModule parameter of the ModuleSwitch event.
- If the NavigationModuleType property of the currently selected Module object is set to olModuleJournal, the sample then displays a dialog box to indicate to the user that the currently selected Journal navigation module is temporarily unavailable, and that instead the Calendar navigation module will be selected.
- Finally, the sample uses the GetNavigationModule method of the Modules collection for the NavigationPane object to attempt to retrieve a CalendarModule object. If successful, the CurrentModule property of the NavigationPane object is set to the retrieved CalendarModule object reference.
|