Share via


OutlookBarShortcuts.ShortcutAdd Event (Outlook)

Occurs when a new shortcut is added to a Shortcuts pane group.

Syntax

expression .ShortcutAdd(NewShortcut)

expression A variable that represents an OutlookBarShortcuts object.

Parameters

Name

Required/Optional

Data Type

Description

NewShortcut

Required

OutlookBarShortcut

The shortcut that is being added.

Remarks

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

Example

This Microsoft Visual Basic for Applications (VBA) example changes the name of a Calendar shortcut when it is added to the first group in 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 myOlSCuts As Outlook.OutlookBarShortcuts 
Dim myOlBar As Outlook.OutlookBarPane 
 
Sub Initialize_handler() 
 Set myOlBar = Application.ActiveExplorer.Panes.Item("OutlookBar") 
 Set myOlSCuts = myOlBar.Contents.Groups.Item(1).Shortcuts 
End Sub 
 
Private Sub myOlSCuts_ShortcutAdd(ByVal NewShortcut As outlook.OutlookBarShortcut) 
 Dim myNS As Outlook.NameSpace 
 
 Set myNS = Application.GetNamespace("MAPI") 
 If NewShortcut.Target.Name = "Calendar" Then 
 NewShortcut.Name = myNS.CurrentUser & "'s Schedules" 
 End If 
End Sub

See Also

Concepts

OutlookBarShortcuts Object Members

OutlookBarShortcuts Object