' a Macro to occurences of a word
' Macro created Saturday, July 03, 1999 by Doug Robbins
'
Dim Message, Title, Default, MyValue
Dim Counter as Long
Message = "Enter the word for which you need the number of occurences" '
Set prompt.
Title = "InputBox Demo" ' Set title.
Default = "" ' Set default.
' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)
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" & Format(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