OutlookBarShortcuts.BeforeShortcutRemove event (Outlook)

Occurs before a new shortcut is removed from a group in the Shortcuts pane, either as a result of user action or through program code.

Syntax

expression. BeforeShortcutRemove( _Shortcut_ , _Cancel_ )

expression A variable that represents an OutlookBarShortcuts object.

Parameters

Name Required/Optional Data type Description
Shortcut Required OutlookBarShortcut The OutlookBarShortcut that is being removed.
Cancel Required Boolean False when the event occurs. If the event procedure sets this argument to True, the shortcut is not removed from the group.

Remarks

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

Example

The following Microsoft Visual Basic for Applications (VBA) example prevents a user from removing a shortcut from the Shortcuts pane. 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.

Dim WithEvents myOlShortcuts As Outlook.OutlookBarShortcuts 
Dim myOlBar As Outlook.OutlookBarPane 
 
Sub Initialize_handler() 
 Set myOlBar = Application.ActiveExplorer.Panes.Item("OutlookBar") 
 Set myOlShortcuts = myOlBar.Contents.Groups.Item(1).Shortcuts 
End Sub 
 
Private Sub myOlShortcuts_BeforeShortcutRemove(ByVal Shortcut As OutlookBarShortcut, Cancel As Boolean) 
 MsgBox "You are not allowed to remove a shortcut from this group." 
 Cancel = True 
End Sub

See also

OutlookBarShortcuts 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.