|Thanks DerbyDad03. I tried that first off -- it returned no occurrences.|
Below is the Macro, in all its glory! Any help would be greatly appreciated.
' Segment_Info_3 Macro
' To find the occrances of multiple words and phrases in one MS Word document
Dim MyCount As Integer, MyCount2 As Integer, MyCount3 As Integer
Dim MyWord As String, MyWord2 As String, MyWord3 As String
Dim Total As Integer
Dim intI As Integer
'Identify the segment words and phrases to search for.
MyWord = "zoo"
MyWord2 = "Zoo keeper"
MyWord3 = "Zoo keeper's helper"
'Select the entire document
'Count the total number of words in the document
Total = Application.Selection.Range.Words.Count
'Enumerate through each word selected, removing leading
' and trailing spaces
For intI = 1 To Total
If LCase(Trim(.Text)) = MyWord Then
MyCount = MyCount + 1
If (LCase(.Text) & LCase(.Text)) = MyWord2 Then
MyCount2 = MyCount2 + 1
If LCase(Trim(.Text)) = MyWord3 Then
MyCount3 = MyCount3 + 1
Dim strMsg As String
strMsg = " The following Segment phrases were found in this document: " & vbNewLine & vbNewLine
strMsg = strMsg & " - " & MyCount & " occurrences of *" & MyWord & "* ;" & vbNewLine
strMsg = strMsg & " - " & MyCount2 & " occurrences of *" & MyWord2 & "* ; " & vbNewLine
strMsg = strMsg & " - " & MyCount3 & " occurrences of *" & MyWord3 & "*"
MsgBox strMsg, vbInformation