Here's a macro that does the same thing without having to type the word
or text into an input box. Just place the cursor in the word or select
the word, then run the macro:
Larry
Sub TextCountQuick()
' Counts current word or selected word or string.
Dim myrange As Range
Dim myPhrase As String
Dim i As Long
Application.ScreenUpdating = False
System.Cursor = wdCursorIBeam
Set myrange = ActiveDocument.Range
' If there is no selection, select current word.
If Selection.Type <> wdSelectionNormal Then Selection.Words(1).Select
' Unselect any empty space after text.
Selection.MoveEndWhile cset:=" ", Count:=wdBackward
myPhrase = Selection.Text
Selection.Collapse wdCollapseStart
myrange.Find.ClearFormatting
myrange.Find.Replacement.ClearFormatting
With myrange.Find
.Text = myPhrase
.Forward = True
.MatchWholeWord = False
.MatchWildcards = False
.Wrap = wdFindforward
Do While .Execute
i = i + 1
Loop
End With
MsgBox "Occurrences of '" & myPhrase & "' " & i, , "Text Count"
' clear Find
myrange.Find.Text = ""
End Sub