Sorry, I meant with the .collapse line deactivate. The macro performs
just as well with or without that line. It seems like it should hang
up and loop on the first term found.
Klaus Linke - 28 Mar 2005 16:47 GMT
Hi Greg,
To debug, generously sprinkle some "myRange.Select" lines into your code, then single-step through it and watch what happens in the document.
If the selected text matches the .Find.Text, Word will go to the next match. You can check that in the user interface.
Still there are lots of situations where you can end up with an endless loop by accident.
Greetings,
Klaus
> Sorry, I meant with the .collapse line deactivate. The macro performs
> just as well with or without that line. It seems like it should hang
> up and loop on the first term found.
Hi Greg,
unfortunately I can't produce an endless loop,
if I want to create one.
Besides that, how the range behaves,
depends on what you do to it.
> Do While .Execute
> myRange.Font.Bold = False ' !!!
> 'myRange.Collapse Direction:=wdCollapseEnd
> Loop
needs no collapsing, as the content of the range,
the string, doesn't change.
Whereas
> Do While .Execute
> myRange.Font.Bold = False
myrange.text = "xxx" ' !!! Content of range changes.
> 'myRange.Collapse Direction:=wdCollapseEnd
> Loop
would need the collapsing.
The first example processes all occurences of "abc".
The second example stops after the first occurence.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Greg - 28 Mar 2005 20:30 GMT
Klaus/Helmut,
My German friends are being most helpful today. Thank you.