Dear Greg
Thank you once again.
I'm doing several find/replacements you thing this could be done
correctly like this:
Sub Test()
Dim myRng As Range
Set myRng = ActiveDocument.Tables(1).Cell(2, 1).Range
With myRng.Find
.Text = "uncle"
.Replacement.Text = "favorit uncle"
.Text = "nefew"
.Replacement.Text = "favorit nefew"
.Text = "sista"
.Replacement.Text = "favorit sista"
.Execute Replace:=wdReplaceAll
End With
End Sub
I mean several replacements inside the same with/range action?
Greg - 26 Oct 2005 15:20 GMT
Abel,
Did you try it? What do you think?
I don't think so, because before the .Execute statement you have only
changed your mind twice regarding what text you want to find and what
you want that text replaced with.
This would work:
Sub Test1()
Dim myRng As Range
Set myRng = ActiveDocument.Tables(1).Cell(2, 1).Range
With myRng.Find
.Text = "uncle"
.Replacement.Text = "favorit uncle"
.Execute Replace:=wdReplaceAll
.Text = "nefew"
.Replacement.Text = "favorit nefew"
.Execute Replace:=wdReplaceAll
.Text = "sista"
.Replacement.Text = "favorit sista"
.Execute Replace:=wdReplaceAll
End With
End Sub