repeated find and replace

A

Anonymous

Hello

I have written a short macro to replace "@p" throughout a document
with a person's name taken from a dialogue box (FirstName).

The code is:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "@p"
With .Replacement
.Text = FirstName
End With
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With

Selection.Find.Execute Replace:=wdReplaceAll

I want to be able to replace heshe with he or she, hisher with his or
her and himher with him or her depending on whether the the person ios
male or female (radio buttons on dialogue box)

Is there a neat way of doing this with loops or do I need to repeat
the find replace script numerous times

Thanks for any help

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top