I might be reinventing the wheel , but I would like to count the number of timers a particular character appears in a doc. I wrote the following code:
Public Sub howMany()
Dim intHow As Integer
Dim strWhat As String
Dim intCount As Integer
Dim myresult As Integer
strWhat = InputBox(“Which character would you like to search for?”, “Search character “)
intHow = 0
intCount = 0
With ActiveDocument.Content.find
.ClearFormatting
Do While .Execute(FindText:=strWhat, Forward:=True, _
Format:=True) = True
intHow = intHow + 1
End If
Loop
End With
x = MsgBox(“The character ” & strWhat & ” appears ” & intHow & ” times”, vbInformation, “Results”)
End Sub
It works, but if the character appears more than 1000 times my computer hangs.
Is there something that does this, or a better way to do it. I thought maybe if I break the doc up and count a paragraph ata time, then it will not hang.
Thanks