应用于 Range 对象的 ComputeStatistics 方法。
返回基于指定范围内容的统计值。Long 类型。
expression.ComputeStatistics(Statistic)
expression 必需。该表达式返回以上一个对象。
Statistic WdStatistic,必需。
| WdStatistic 可以是下列 WdStatistic 常量之一: | 
| wdStatisticCharacters | 
| wdStatisticCharactersWithSpaces | 
| wdStatisticFarEastCharacters | 
| wdStatisticLines | 
| wdStatisticPages | 
| wdStatisticParagraphs | 
| wdStatisticWords | 
应用于 Document 对象的 ComputeStatistics 方法。
返回基于指定文档内容的统计值。Long 类型。
expression.ComputeStatistics(Statistic, IncludeFootnotesAndEndnotes)
expression 必需。该表达式返回以上的一个对象。
Statistic WdStatistic,必需。
| WdStatistic 可以是下列 WdStatistic 常量之一: | 
| wdStatisticCharacters | 
| wdStatisticCharactersWithSpaces | 
| wdStatisticFarEastCharacters | 
| wdStatisticLines | 
| wdStatisticPages | 
| wdStatisticParagraphs | 
| wdStatisticWords | 
IncludeFootnotesAndEndnotes Variant 类型,可选。如果为 True,则统计时将包括脚注和尾注;如果省略该参数,则默认值为 False。
由于您选择或安装的语言支持(例如美式英语)不同,上述部分常量可能无法使用。
本示例显示 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."
本示例显示活动文档的字数(包括脚注)。
MsgBox _
    ActiveDocument.ComputeStatistics(Statistic:=wdStatisticWords, _
    IncludeFootnotesAndEndnotes:=True) & " words"