Muokkaa

Jaa


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

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.