What is the easiest way to run a word VBA script as many times as needed? -
i know question title not clear, can clarify:
consider next vba script (written m. paige):
sub rem_space() set myrange = activedocument.content myrange.find .text = " :" .replacement.text = ":" .execute replace:=wdreplaceall, forward:=true, _ wrap:=wdfindcontinue end end sub
this replace each instance of " :" ":".
the problem have arbitrary amount of spaces, , have run multiple times eliminate instances of " :".
so, best way modify vba script create have run once, resulting in number of arbitrary spaces before colon beingness removed.
should vba script recursive?
should search document determine spaces before colon , run vba script number of times?
would running vba script within loop say, 100 times grab everything?
what easiest solution implement?
this 1 duplicates phone call .execute
, doesn't rely on infinite loop.
with myrange.find .text = " :" .replacement.text = ":" .execute replace:=wdreplaceall, forward:=true, wrap:=wdfindcontinue while .found .execute replace:=wdreplaceall, forward:=true, wrap:=wdfindcontinue loop end
or perhaps do...loop while
loop instead.
with myrange.find .text = " :" .replacement.text = ":" .execute replace:=wdreplaceall, forward:=true, wrap:=wdfindcontinue loop while .found end
vba ms-word word-vba
No comments:
Post a Comment