OutlookBarPane.BeforeNavigate event (Outlook)

Occurs when the user clicks a shortcut in the Shortcuts pane to navigate to a different folder.

Syntax

expression. BeforeNavigate( _Shortcut_ , _Cancel_ )

expression A variable that represents an 'OutlookBarPane' object.

Parameters

Name Required/Optional Data type Description
Shortcut Required OutlookBarShortcut The shortcut that the user clicked.
Cancel Required Boolean False when the event occurs. If the event procedure sets this argument to True, the current folder is not changed.

Remarks

This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).

Example

This Microsoft Visual Basic for Applications (VBA) example prevents the user from using the Shortcuts pane to open the Notes folder. The sample code must be placed in a class module, and the Initialize_handler routine must be called before the event procedure can be called by Microsoft Outlook. If you don't have a shortcut to the Notes folder already, you need to create one to run this example.

Public WithEvents myOlPane As Outlook.OutlookBarPane 
 
 
 
Public Sub Initialize_handler() 
 
 Set myOlPane = Application.ActiveExplorer.Panes.Item("OutlookBar") 
 
End Sub 
 
 
 
Private Sub myOlPane_BeforeNavigate(ByVal Shortcut As Outlook.OutlookBarShortcut, Cancel As Boolean) 
 
 If Shortcut.Name = "Notes" Then 
 
 MsgBox "You cannot view the Notes folder." 
 
 Cancel = True 
 
 End If 
 
End Sub

See also

OutlookBarPane Object

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.