If you are only doing find and replace in the vba module code, why bother to use
a find and replace function?
However, here is some vba code that returns the position in a string of a string
by whole words. This will probably wrap lines in the newsreader. It also if I
remember correctly only returns the position of the first match.
Perhaps you can modify this to do what you want.
Public Function FindWholeString(strSearch, strFind) As Long
'*******************************************
'Name: FindWholeString (Function)
'Purpose: Looks in a string to see
' if it contains a second string as a whole word
'Author: John Spencer UMBC-CHPDM
'Date: April 19, 2000, 02:10:35 PM
'Called by:
'Calls:
'Inputs: strSearch as string to be examined, strFind as string to be located
'Output: >0 indicates string found, 0 or < 0 indicates string not found
'*******************************************
'What Characters do we want to delimit whole word
Const strDelimiters As String = "[] ().!, """
Dim lngPos As Long
Dim tfStart As Boolean, tfEnd As Boolean
'Is found text delimited with indicator of whole word
lngPos = InStr(strSearch, strFind)
If lngPos > 0 Then 'String is there, now let's see if it is a whole word
If lngPos = 1 Then 'At beginning of string so tfStart is true
tfStart = True
Else
tfStart = InStr(strDelimiters, _
Mid(strSearch, lngPos - 1, 1)) > 0
End If
If lngPos + Len(strFind) = Len(strSearch) Then
'at end of string so tfStart is true
tfEnd = True
Else
tfEnd = InStr(strDelimiters, _
Mid(strSearch, lngPos + Len(strFind), 1)) > 0
End If
End If
'Recursive call to look for next occurence
'if last occurence did not match as whole word
If lngPos > 0 And Not (tfStart And tfEnd) Then
lngPos = lngPos * -1
lngPos = FindWholeString(Mid(strSearch, _
Abs(lngPos) + Len(strFind)), strFind)
End If
'tfReturn = tfStart And tfEnd And lngPos > 0
FindWholeString = lngPos
End Function