ComputeStatistics Method Example
This example displays the number of words and characters in the first paragraph of Report.doc.
Set myRange = Documents("Report.doc").Paragraphs(1).Range
wordCount = myRange.ComputeStatistics(Statistic:=wdStatisticWords)
charCount = _
myRange.ComputeStatistics(Statistic:=wdStatisticCharacters)
MsgBox "The first paragraph contains " & wordCount _
& " words and a total of " & charCount & " characters."
This example displays the number of words in the active document, including footnotes.
MsgBox _
ActiveDocument.ComputeStatistics(Statistic:=wdStatisticWords, _
IncludeFootnotesAndEndnotes:=True) & " words"