Hi Ed,
That's a pain, isn't it? :-S It's one of a number of situations where VBA
behaves differently from the same operation in the UI.
Declare another Range object, say
Dim oContainRange As Range
Set oContainRange = Selection.Range
Then change the .Execute line to
While .Execute And oRng.InRange(oContainRange)
The second part of the condition will be false if oRg is outside
oContainRange.

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
> I have code which is supposed to find instances of 2 or more spaces
> and replace them with one space. It's supposed to work within a set
[quoted text clipped - 23 lines]
> Wend
> End With
Ed from AZ - 04 Feb 2008 19:43 GMT
Beautiful!! Thank you, Jay! I didn't know about that InRange - I
always tried something like setting another range and comparing the
ends or such. This is going to make a _lot_ of things much easier!
Ed
> Hi Ed,
>
[quoted text clipped - 49 lines]
>
> - Show quoted text -