Word's word count

B

Barbara Graham

Does anyone know if there is any way to get the word count for headers,
footers, footnotes, etc. for a Word document? This is not available in Word
itself, but I thought perhaps it was available in automation.
 
C

Cindy M -WordMVP-

Hi Barbara,
Does anyone know if there is any way to get the word count for headers,
footers, footnotes, etc. for a Word document?
If you want the word count for EVERYTHING, you'll need to walk through all
the "stories" in the Word document. You should find a discussion on that
at word.mvps.org (it's often used for Find/Replace). It can also be
derived from the Help examples on StoryRanges and related topics.
The WordCount is a property of the Range object, which means it also
applies to a StoryRange.

If you're primarily interested in a specific story, then it would look
something like this:

Dim rng as Word.Range

Set rng = ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range
MsgBox rng.WordCount

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top