Program/feature for finding and replacing texts in a Word document

S

Satish

Hi,
My requirement is I want some program/feature to automatically find specific
texts in a document and replace them with a different text. I wouldn't want
to use Word's Autocorrect because it is stored in the Normal template (If I
am not mistaken, that is). My requirement is only for documents that were
created using a specific template. What would best meet my requirement?

Thanks,
Satish
 
S

Satish

Thanks but could you please point me to an automatic program for my users
and not a manual find and replace. After my users create a Word doc, they
would run this program that would automatically search for, say "Men in
Black" for n times and replace them all with "MIB".

I know the specific text that such a program should find and replace. This
program would be searching and replacing the same text always. In the above
example, the program, that I am looking for, is capable of searching only for
"Men in Black" and it would also replace it with "MIB" wherever it finds it.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?U2F0aXNo?=,
Thanks but could you please point me to an automatic program for my users
and not a manual find and replace. After my users create a Word doc, they
would run this program that would automatically search for, say "Men in
Black" for n times and replace them all with "MIB".

I know the specific text that such a program should find and replace. This
program would be searching and replacing the same text always. In the above
example, the program, that I am looking for, is capable of searching only for
"Men in Black" and it would also replace it with "MIB" wherever it finds it.
Record doing the serch in a macro and place it on a toolbar. clicking the button
will run the macro. If you have a series of replace actions that should all be
performed on the same document, you can combine the macros into a single one.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
G

Graham Mayor

Perhaps you would give as a clue and tell us what texts you want to search
and replace?
You could probably manage with an array such as:

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long

vFindText = Array(Chr(33), "Lorem", "ipsum", "dolor")
vReplText = Array(Chr(46), "WORD1", "WORD2", "WORD3")
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Execute replace:=wdReplaceAll
Next i
End With

End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Satish

Thanks Graham. It worked just like I wanted it to. Maybe, I need to tweak it
a bit. I am not a technical person, so might face some difficulty doing that.
But, thanks anyway. It was a great help.
 

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