D
dsc
In the normal Word search dialog box, there are conditions that can be set.
Find whole word only, match case, use wildcards, etc.
I can't get them to work properly in a macro.
For instance, when I set it as follows:
With ActiveDocument.Content.Find
.Text = srchTxt
.Replacement.Text = NewDef
.Forward = True
.wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = True
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
.Execute Replace:=wdReplaceAll
End With
My macro will search for the acronym ERM, think it has found it in the word,
thermoplastic, and I end up with thELECTRONIC RADIATION MONITORoplastic.
It shouldn't do that, I think, because I have both matchcase and
matchwholeword set to true. Nonetheless, it does.
Can anybody give me a clue? Thanks in advance.
Find whole word only, match case, use wildcards, etc.
I can't get them to work properly in a macro.
For instance, when I set it as follows:
With ActiveDocument.Content.Find
.Text = srchTxt
.Replacement.Text = NewDef
.Forward = True
.wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = True
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
.Execute Replace:=wdReplaceAll
End With
My macro will search for the acronym ERM, think it has found it in the word,
thermoplastic, and I end up with thELECTRONIC RADIATION MONITORoplastic.
It shouldn't do that, I think, because I have both matchcase and
matchwholeword set to true. Nonetheless, it does.
Can anybody give me a clue? Thanks in advance.