Share via


Fields.Count Property

Publisher Developer Reference

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

Syntax

expression.Count

expression   A variable that represents a Fields object.

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

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

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

Visual Basic for Applications
  Sub CountNumberOfShapes()
    Dim intShapes As Integer
    Dim pg As Page
For Each pg In ActiveDocument.Pages
    intShapes = intShapes + pg.Shapes.<strong class="bterm">Count</strong>
Next

MsgBox "Your publication contains " &amp; intShapes &amp; " shape(s)."

End Sub

See Also