Count Property

Applies To

BalloonCheckboxes collection object, BalloonLabels collection object, CommandBarControls collection object, CommandBars collection object, DocumentProperties collection object, FoundFiles object, PropertyTests collection object.

Description

Returns the number of items in the specified collection. Read-only Long.

Remarks

For the CommandBars collection, the count includes only menu bars, toolbars, and shortcut menus. Menus and submenus aren't included.

Example

This example uses the Count property to display the number of command bars in the collection.

MsgBox "There are " & CommandBars.Count & " bars in your collection."
This example uses the Count property to display the number of check boxes in the Office Assistant balloon.

With Assistant.NewBalloon
    .CheckBoxes(1).Text = "First Choice"
    .CheckBoxes(2).Text = "Second Choice"
    .Text = "You have the following " _
        & .CheckBoxes.Count & " choices."
    .Show
End With
This example uses the Count property to display the number of labels in the Office Assistant balloon.

With Assistant.NewBalloon
    .Heading = "Check Your Age Group."
    .Labels(1).Text = "20 to 29."
    .Labels(2).Text = "30 to 39."
    .Labels(3).Text = "40 or over"
    .Text = "Which of the following " _
        & .Labels.Count & " choices apply to you?"
    .Show
End With
This example displays the number of document properties in the DocumentProperties collection that was passed to the procedure.

Sub CountDocumentProperties(dp As DocumentProperties)
    MsgBox "There are " & dp.Count & " properties in the collection."
End Sub