Groups Property

Microsoft Outlook Visual Basic

Show All

Groups Property

       

Returns an OutlookBarGroups object representing the set of groups in an Outlook Bar.

expression.Groups

expression   Required. An expression that returns an OutlookBarStorage object.

Example

The following Microsoft Visual Basic/Visual Basic for Applications example displays the number of groups in the Outlook Bar.

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

If you use VBScript, you do not create the Application object. This example shows how to perform the same task using VBScript.

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