Share via


Count Property [Publisher 2003 VBA Language Reference]

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

expression.Count

expression Required. An expression that returns one of the above objects.

Example

This example displays the number of pages in the active document.

Sub CountNumberOfPages()
    MsgBox "Your publication contains " & _
        ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Sub CountNumberOfShapes()
    Dim intShapes As Integer
    Dim pg As Page

    For Each pg In ActiveDocument.Pages
        intShapes = intShapes + pg.Shapes.Count
    Next

    MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub

Applies to | Adjustments Object | BorderArts Collection | CatalogMergeShapes Collection | CellRange Collection | ColorSchemes Collection | ColorsInUse Collection | Columns Collection | Documents Collection | Fields Collection | GroupShapes Collection | Hyperlinks Collection | InlineShapes Collection | Labels Collection | MailMergeDataFields Collection | MailMergeFilters Collection | MailMergeMappedDataFields Collection | MasterPages Collection | ObjectVerbs Collection | Pages Collection | Plates Collection | PrintablePlates Collection | Rows Collection | RulerGuides Collection | Sections Collection | ShapeNodes Collection | ShapeRange Collection | Shapes Collection | Stories Collection | TabStops Collection | Tags Collection | TextStyles Collection | WebHiddenFields Collection | WebListBoxItems Object | WebNavigationBarHyperlinks Object | WebNavigationBarSets Collection | WizardProperties Collection | WizardValues Collection