OutlookBarGroups.BeforeGroupAdd event (Outlook)
Occurs before a new group is added to the Shortcuts pane, either as a result of user action or through program code.
Syntax
expression. BeforeGroupAdd
( _Cancel_
)
expression A variable that represents an OutlookBarGroups object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the group is not added to the Shortcuts pane. |
Remarks
This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).
Example
This Visual Basic for Applications (VBA) example prevents the user from adding a group to the Shortcuts pane. The sample code must be placed in a class module such as ThisOutlookSession
, and the Initialize_handler
routine must be called before the event procedure can be called by 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_BeforeGroupAdd(Cancel As Boolean)
Cancel = True
End Sub
See also
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.