S
Scott
Help please.
I'm trying to perform a search and replace operation repeatedly until it finds
nothing more to replace. For example, to remove all the spaces at the end of
all the lines in a document I want to find " ^p" and replace it with "^p" and
then repeat the operation until all replacements have been made.
I'm not having any luck finding something to test that indicates whether a
replacement was made in the last attempt.
Here's an abbreviated version of what I tried most recently
Do
With Selection.Find
.Text = " ^p"
.Replacement.Text = "^p"
End With
Selection.Find.Execute Replace:=wdReplaceAll
Loop While Selection.Find.Found = True
But it doesn't work. It goes through the code only once.
Thanks,
Scott
I'm trying to perform a search and replace operation repeatedly until it finds
nothing more to replace. For example, to remove all the spaces at the end of
all the lines in a document I want to find " ^p" and replace it with "^p" and
then repeat the operation until all replacements have been made.
I'm not having any luck finding something to test that indicates whether a
replacement was made in the last attempt.
Here's an abbreviated version of what I tried most recently
Do
With Selection.Find
.Text = " ^p"
.Replacement.Text = "^p"
End With
Selection.Find.Execute Replace:=wdReplaceAll
Loop While Selection.Find.Found = True
But it doesn't work. It goes through the code only once.
Thanks,
Scott