Find and replace........Advice Please

D

Dermot

I have a document which has boilerplate text I want to use.
In the text I have many uses of...first names, his, he, him, her, she, they,
them, etc.

I haven't used find very often, but when I used it to replace say she with
he......and selected replace all......every reference.......even the text
within a word was changed.

Question 1
Do I have to manually click through every find and change it appropriately?

Question 2
I know I could create two templates but would like to know if there are any
other options open to me that I might have overlooked.

Question 3
Put another way.
What would be considered the correct way to use Word 2003 to achieve my
goal.....?
.....I could describe the document as a master....
....It has to be taylored to each individual male or female...
In some situations it may be neccessary to include personalised paragraphs.
Thanks In Advance
 
M

macropod

Hi Dermot,

To replace 'he' as a whole world and not when it's found in other words, like 'help', use the 'More' tab on the 'Find' dialogue box
and check the 'Find whole words only' option.

Rather than creating multiple templates, you could use a formfield or a FILLIN field to ask the user whether the recipient is male,
female, both or indeterminate, then have combined IF and REF fields elsewhere in the document to vary the text accordingly. A bit of
work to set up, but is does result in only one template being needed.

Cheers

--
macropod
[MVP - Microsoft Word]


| I have a document which has boilerplate text I want to use.
| In the text I have many uses of...first names, his, he, him, her, she, they,
| them, etc.
|
| I haven't used find very often, but when I used it to replace say she with
| he......and selected replace all......every reference.......even the text
| within a word was changed.
|
| Question 1
| Do I have to manually click through every find and change it appropriately?
|
| Question 2
| I know I could create two templates but would like to know if there are any
| other options open to me that I might have overlooked.
|
| Question 3
| Put another way.
| What would be considered the correct way to use Word 2003 to achieve my
| goal.....?
| ....I could describe the document as a master....
| ...It has to be taylored to each individual male or female...
| In some situations it may be neccessary to include personalised paragraphs.
| Thanks In Advance
|
 
H

Helmut Weber

Hi Macropod,
you could use a formfield or a FILLIN field to ask the user
whether the recipient is male, female, both or indeterminate

a beautiful sample of political correctness. ;-)

Not all is boolean.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
G

Greg Maxey

Dermot,

Part of what makes that a difficult task is determining the form of the
replacement.

For example if we had

She is a pretty girl. Her house is red. Give the ball to her. That car is
hers.

All very simple sentences. Replace she with he, her with him and hers with
his and you would get:

He is a pretty girl. His house is red. Give the ball to his. That car is
his.

Pretty sloppy, wouldn't you say?

Here is some code that does a medicore job of it. The "pretty girl" part is
between you and the girl or the offended party:
Sub FRUsingAnArray()
Dim SearchArray As Variant
Dim ReplaceArray As Variant
Dim oRng As Range
Dim i As Long
Dim FindString As String
Dim RplString As String
Dim bMale As Boolean
bMale = True
If MsgBox("Routine is set convert gender male to gender female. Do you want
to" _
& " convert gender female to gender male?", vbYesNo) = vbYes Then
bMale = False
End If
If bMale Then
SearchArray = Array("he", "him", "his")
ReplaceArray = Array("she", "her", "hers")
Else
SearchArray = Array("she", "her", "hers")
ReplaceArray = Array("he", "him", "his")
End If
Set oRng = ActiveDocument.Range
For i = 0 To UBound(SearchArray)
FindString = SearchArray(i)
RplString = ReplaceArray(i)
With oRng.Find
.Text = FindString
.Replacement.Text = RplString
.MatchWholeWord = True
Select Case i
Case Is = 0
.Execute Replace:=wdReplaceAll
Case Is = 1
If Not bMale Then
While .Execute
oRng.Select
oRng.Text = InputBox("Type in replacement:", "User Input")
oRng.Collapse wdCollapseEnd
Wend
Else
.Execute Replace:=wdReplaceAll
End If
Case Is = 2
If bMale Then
While .Execute
oRng.Select
oRng.Text = InputBox("Type in replacement:", "User Input")
oRng.Collapse wdCollapseEnd
Wend
Else
.Execute Replace:=wdReplaceAll
End If
End Select
End With
Next
End Sub
 
D

Dermot

Thanks macropod.....I should have noticed the more option.....I knew this
honest!!
I will have a look at the fields you describe and experiment, sounds good to
me.
Thanks
Dermot
 

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