Partager via


Groups Property

Returns an OutlookBarGroups object representing the set of groups in the Shortcuts pane.

expression**.Groups**

*expression   * Required. An expression that returns an OutlookBarStorage object.

Example

The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example displays the number of groups in the Shortcuts pane.

Sub CountOlBarGroups()
    Dim myOlApp As New Outlook.Application
    Dim myOlBar As Outlook.OutlookBarPane
    Dim myCount As Integer
    Set myOlBar = myOlApp.ActiveExplorer.Panes.Item("OutlookBar")
    myCount = myOlBar.Contents.Groups.Count
    MsgBox "There are " & myCount & " groups in the Shortcuts pane"
End Sub

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object. This example shows how to perform the same task using VBScript code.

Set myOlBar = Application.ActiveExplorer.Panes.Item("OutlookBar")
myCount = myOlBar.Contents.Groups.Count
MsgBox "There are " & myCount & " groups in the Shortcuts pane"

Applies to | OutlookBarStorage Object

See Also | Contents Property