Change a great number of words in word files, with a macro as short as possible.

Joined
Dec 16, 2022
Messages
4
Reaction score
0
I use the macro below to correct words in a text.
However I have dozens of words to correct in dozens of files!
How could I use a loop (if possible) to enter two lists of words (the old - the new) in order not to copy paste dozens of small macros such as below ?
( I have to duplicate the macro when the program is too big :()
Thanks for your attention and for your help ! :)
Cheers,
Lenrubé


Sub tipee

Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "inaccuratly"
.Replacement.Text = "inaccurately"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "presance"
.Replacement.Text = "presence"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "assment"
.Replacement.Text = "assessment"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
 
Joined
Dec 16, 2022
Messages
4
Reaction score
0
Problem solved tonight.
Someone sent me a short macro, using array variable ( or variable array ).
Cheers,
 

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