exlcude tables in word count

K

Khilna

Hello


Does anyone know how I can run the word count tool in
Word 97 and get it to exclude the words in tables and inside brackets from
the total word count?


Many thanks for your help.

Khilna
 
J

Jezebel

Save the document. Delete all tables and text in brackets. Get your word
count. Close without saving.
 
G

Greg

For automating Jezebels suggestions you might use something like:

Sub ScratchMacro()
Dim myString As String
Dim oStoryRng As Word.Range
Dim i As Long

myString = ActiveDocument.FullName
ActiveDocument.Close wdSaveChanges
Documents.Open FileName:=myString
For i = ActiveDocument.Tables.Count To 1 Step -1
ActiveDocument.Tables(i).Delete
Next
For Each oStoryRng In ActiveDocument.StoryRanges
Do Until (oStoryRng Is Nothing)
With oStoryRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\{*\}"
.Replacement.Text = ""
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Set oStoryRng = oStoryRng.NextStoryRange
Loop
Next
MsgBox ActiveDocument.ComputeStatistics(wdStatisticWords)
ActiveDocument.Close wdDoNotSaveChanges
Documents.Open FileName:=myString
End Sub
 

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