BeforeShortcutRemove Event
Occurs before a new shortcut is removed from a group in the Outlook Bar, either as a result of user action or through program code. This event is not available in VBScript.
Sub object_BeforeShortcutRemove(ByVal Shortcut As OutlookBarShortcut, Cancel As Boolean)
object An expression that evaluates to an OutlookBarShortcuts collection object.
Shortcut Required. The OutlookBarShortcut that is being removed.
Cancel Optional. False when the event occurs. If the event procedure sets this argument to True, the shortcut is not removed from the group.
Example
The following example prevents a user from removing a shortcut from the first Outlook Bar group. 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 myOlApp As New Outlook.Application
Dim WithEvents myOlShortcuts As Outlook.OutlookBarShortcuts
Dim myOlBar As Outlook.OutlookBarPane
Sub Initialize_handler()
Set myOlBar = myOlApp.ActiveExplorer.Panes.Item("OutlookBar")
Set myOlShortcuts = myOlBar.Contents.Groups.Item(1).Shortcuts
End Sub
Private Sub myOlShortcuts_BeforeShortcutRemove(Cancel As Boolean)
MsgBox "You are not allowed to remove a shortcut from this group."
Cancel = True
End Sub