Re: Match Whole Word by Ed
Ed
Fri Jan 23 15:38:44 CST 2004
The whole Selection.Find code as recorded my the Macro Recorder usually
looks something like this:
Selection.Find.ClearFormatting
With Selection.Find
.Text = "your text here"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
You can set these to the desired parameters. For more on this, see Execute
Method (Find Object) in the VBA help.
Ed
"Joanne" <jebuss@msn.com> wrote in message
news:OVlwEHe4DHA.2404@TK2MSFTNGP12.phx.gbl...
> In a macro, I used Ctrl+Find to locate the word "East" in an addr line
> and change it to "E". While this works fine, it also changes
> "Eastwood" to "Ewood". I tried using MatchWholeWord=True but it didn't
> help.
> I notice that when I use Ctrl+Find outside of the macro environment,
> it allows me to choose "Find Whole Words Only'.
> My question is how do I make the macro using Ctrl+Find to use the
> "Find Whole Words Only" command.
> Thanks muchly for your time and expertise
> Joanne