OutlookBarGroups.GroupAdd event (Outlook)

Occurs when a new group has been added to the Shortcuts pane.

Syntax

expression. GroupAdd( _NewGroup_ )

expression A variable that represents an OutlookBarGroups object.

Parameters

Name Required/Optional Data type Description
NewGroup Required OutlookBarGroup The OutlookBarGroup that was added.

Remarks

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

Example

This Microsoft Visual Basic for Applications (VBA) example adds a shortcut to the Calendar whenever a group is created. 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 myOlGroups As Outlook.OutlookBarGroups 
Dim myOlBar As Outlook.OutlookBarPane 
 
Sub Initialize_handler() 
 Set myOlBar = Application.ActiveExplorer.Panes.Item("OutlookBar") 
 Set myOlGroups = myOlBar.Contents.Groups 
End Sub 
 
Private Sub myOlGroups_GroupAdd(ByVal NewGroup As Outlook.OutlookBarGroup) 
 Dim myFolder As Outlook.Folder 
 Set myFolder = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar) 
 NewGroup.Shortcuts.Add myFolder, "Calendar" 
End Sub

See also

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