Word Counting, but excluding Tables, Captions, and certain other styles

C

Chris

Does anyone know of any tools available to enhance the word count available in Word. I need to count the number of words in a large (>30,000) word document, but omit anything in tables, text boxes, and anything in the styles "Caption", "Heading1-7", "References". I have tried programming a VB macro to iterate between paragraphs, but it seems to get confused when skipping tables
This would be useful for other university students and academics.
 
H

Helmut Weber

Hi Chris,
1. Discussions on word definitions are endless
and lead to no result.
2. Textframes, headers, footers, references, are
excluded from being counted anyway, but not e.g.
the numbers of references: Have a look at this:
' wdMainTextStory = 1
' wdStatisticWords = 0
With ActiveDocument
MsgBox .StoryRanges(1).ComputeStatistics(0)
MsgBox .Words.Count
MsgBox .ComputeStatistics(0)
MsgBox .StoryRanges(1).Words.Count
End With
To exclude words in tabels, just count the words
in tables and deduct their number from all others:
' Count word in tables
Dim oTbl As Table
Dim lWTb As Long ' Words in Tables
For Each oTbl In ActiveDocument.Range.Tables
lWTb = lWTb + oTbl.Range.Words.Count
Next
To exclude words in headlines etc. you may try:
' Count all words but words in headings
Dim oPrg as paragraph
Dim lWrd As Long ' Words to be counted
For Each oPrg In ActiveDocument.StoryRanges(1).Paragraphs
If oPrg.OutlineLevel = 10 Then
lWrd = lWrd + oPrg.Range.Words.Count
End If
Next

Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, W98
 
G

Greg Oij

You might try selecting the tables and hiding them before
performing the word count function. I have noticed a
number in inconsistencies in the Word Count function in
Word... counting words in document sometimes yields a
different count than selecting the all of the text in the
document...
-----Original Message-----
Does anyone know of any tools available to enhance the
word count available in Word. I need to count the number
of words in a large (>30,000) word document, but omit
anything in tables, text boxes, and anything in the
styles "Caption", "Heading1-7", "References". I have
tried programming a VB macro to iterate between
paragraphs, but it seems to get confused when skipping
tables.
 

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