Yes. Keep the function as is. Add the follwoing Sub to
the module:
Sub CountStringInDoc()
Dim findthis, messg As String, thenum As Long
findthis = InputBox("Enter the word or phrase to
count.", "Count in Document")
thenum = CountInDoc(ActiveDocument, findthis)
If thenum = 1 Then messg = " time in this document."
Else messg = " times in this document."
messg = "'" & findthis & "' occurs " & thenum & messg
MsgBox messg, , "Count in Document"
End Sub
As you use this keep in mind that
the .MatchWholeWord, .MatchCase, etc. properties as set
in the original function will affect the results. If you
want to be able to specify those properties at run-time,
you'll need to design your own userform. That would be a
good learning project, by the way.
>-----Original Message-----
>Could this be set up so that the user can enter what word
[quoted text clipped - 36 lines]
>>
>.
Robin - 30 Jun 2004 20:44 GMT
Thanks! I will practice, practice, practice.
>-----Original Message-----
>Yes. Keep the function as is. Add the follwoing Sub to
[quoted text clipped - 63 lines]
>>
>.