Count instance of a specific word

E

EazyE

I need to count the number of instances a specific word is used in a very large document. Hopefully using something that will return a "count()" result....
 
C

Charles Kenyon

Within the document, replace the word with itself. Word will tell you how
many times it was found.
--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

EazyE said:
I need to count the number of instances a specific word is used in a very
large document. Hopefully using something that will return a "count()"
result....
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Dim Title as String, MyValue as String, Counter as Long

Message = "Enter the word for which you need the number of occurences" '
Set prompt.
Title = "InputBox Demo" ' Set title.
'Display Input Box.
MyValue = InputBox(Message, Title)
Selection.HomeKey Unit:=wdStory|
With ActiveDocument.Content.Find
.MatchWholeWord = True
Counter = 0
Do While .Execute(FindText:=MyValue, Forward:=True) = True
Counter = Counter + 1
Loop
End With
MsgBox "The word " + MyValue + " appears" + Str$(Counter) + " times."


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
J

jesse

yead i c word will tell. But im wondering how we can retrieve that count programmaticall
 

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