Expand Minimize

Range.ComputeStatistics Method (Word)

Returns a Long that represents a statistic based on the contents of the specified range.

expression .ComputeStatistics(Statistic)

expression Required. A variable that represents a Range object.

Parameters

Name

Required/Optional

Data Type

Description

Statistic

Required

WdStatistic

The type of statistic to compute.

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

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."

Concepts

Other resources

Show:
© 2014 Microsoft