Hi Mido,
You can shorten the routine some by not repeating all of the parameters for
the find/replace. Also, instead of creating a separate block for each
replace, you might consider creating two arrays and using that to cycle
through the find and replace words. Here's an example of eliminating the
repetition and using arrays for the find and replace.
Dim sFind As Variant
Dim sReplace As Variant
Dim iCount As Integer
sFind = Array("Test1", "Test2", "Test3", "Test4")
sReplace = Array("Replace1", "Replace2", "Replace3", "Replace4")
With Selection.Find
.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Replacement.ClearFormatting
'''start the loop here so that
'''you don't repeat all of the
'''above commands
For iCount = 0 To UBound(sFind)
.Text = sFind(iCount)
.Replacement.Text = sReplace(iCount)
.Execute Replace:=wdReplaceAll
Next iCount
End With
End Sub
HTH,
Dave
> Hello folks, first of all I would like to thank you for your effort and
> great help.
[quoted text clipped - 98 lines]
> right in deleting them?
> Thanks a lot for your help!
Mido - 13 Jan 2006 20:55 GMT
Hi Dave,
Thanks a lo for your help. As you might have found out that I am just
starting in this. I will try your solution and I really apprecciate it.
If you need any help with languages, do not hesitate!
> Hi Mido,
>
[quoted text clipped - 138 lines]
> > right in deleting them?
> > Thanks a lot for your help!