Count Property
Applies To
AddIns collection object, Adjustments object, AutoCaptions collection object, AutoCorrectEntries collection object, AutoTextEntries collection object, Bookmarks collection object, Borders collection object, CaptionLabels collection object, Cells collection object, Characters collection object, Columns collection object, Comments collection object, CustomLabels collection object, Dialogs collection object, Dictionaries collection object, Documents collection object, Endnotes collection object, Fields collection object, FileConverters collection object, FirstLetterExceptions collection object, FontNames object, Footnotes collection object, FormFields collection object, Frames collection object, GroupShapes collection object, HeadersFooters collection object, HeadingStyles collection object, Hyperlinks collection object, Indexes collection object, InlineShapes collection object, KeyBindings collection object, KeysBoundTo collection object, Languages collection object, ListEntries collection object, ListGalleries collection object, ListLevels collection object, ListParagraphs collection object, Lists collection object, ListTemplates collection object, MailMergeDataFields collection object, MailMergeFieldNames collection object, MailMergeFields collection object, PageNumbers collection object, Panes collection object, Paragraphs collection object, ProofreadingErrors collection object, ReadabilityStatistics collection object, RecentFiles collection object, Revisions collection object, Rows collection object, Sections collection object, Sentences collection object, ShapeNodes collection object, ShapeRange collection object, Shapes collection object, SpellingSuggestions collection object, StoryRanges collection object, Styles collection object, Subdocuments collection object, Tables collection object, TablesOfAuthorities collection object, TablesOfAuthoritiesCategories collection object, TablesOfContents collection object, TablesOfFigures collection object, TabStops collection object, Tasks collection object, Templates collection object, TextColumns collection object, TwoInitialCapsExceptions collection object, Variables collection object, Versions collection object, Windows collection object, Words collection object.
Description
Returns the number of items in the specified collection. Read-only Long.
See Also
First property, Index property, Item method, Last property, Uniform property.
Example
This example displays the number of paragraphs in the active document.
MsgBox "The active document contains " & _
ActiveDocument.Paragraphs.Count & " paragraphs."
This example displays the number of words in the selection.
If Selection.Words.Count >= 1 And Selection.Type <> wdSelectionIP Then
MsgBox "The selection contains " & Selection.Words.Count _
& " words."
End If
This example uses the aFields() array to store the field codes in the active document.
fcount = ActiveDocument.Fields.Count
If fcount >= 1 Then
ReDim aFields(fcount)
For Each aField In ActiveDocument.Fields
aFields(aField.Index) = aField.Code.Text
Next aField
End If