Can the following two loops be combined into one? I need to do
multiple find and replace and it's taking a long time. I hope if I
can do multiple find and replace in just one loop, it'll take less
time.
Do While .Execute(FindText:=" <", ReplaceWIth:="<",
MatchWildcards:=False, Wrap:=wdFindContinue, Forward:=True) = True
Loop
Do While .Execute(FindText:="(", ReplaceWIth:=vbTab + "(",
MatchWildcards:=False, Wrap:=wdFindContinue, Forward:=True) = True
Loop
Jay Freedman - 27 Jun 2005 02:58 GMT
>Can the following two loops be combined into one? I need to do
>multiple find and replace and it's taking a long time. I hope if I
[quoted text clipped - 8 lines]
>MatchWildcards:=False, Wrap:=wdFindContinue, Forward:=True) = True
> Loop
They can't be combined, but there's no reason to do loops, which are
just time-wasters.
Include the parameter Replace:=wdReplaceAll in each .Execute and call
it just once:
.Execute FindText:=" <", ReplaceWIth:="<", _
MatchWildcards:=False, Wrap:=wdFindContinue, _
Forward:=True, Replace:=wdReplaceAll
.Execute FindText:="(", ReplaceWIth:=vbTab + "(", _
MatchWildcards:=False, Wrap:=wdFindContinue, _
Forward:=True, Replace:=wdReplaceAll
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org