Document.ComputeStatistics Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a statistic based on the contents of the specified document. Long.

expression .ComputeStatistics(Statistic, IncludeFootnotesAndEndnotes)

expression Required. A variable that represents a Document object.

Parameters

Name

Required/Optional

Data Type

Description

Statistic

Required

WdStatistic

The statistic to compute.

IncludeFootnotesAndEndnotes

Optional

Variant

True to include footnotes and endnotes when computing statistics. If this argument is omitted, the default value is False.

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 in the active document, including footnotes.

MsgBox ActiveDocument.ComputeStatistics(Statistic:=wdStatisticWords, _ 
 IncludeFootnotesAndEndnotes:=True) & " words"
Show: