D
david.f.jenkins
I have an application where I'm looping through and editing words in a
text range. As part of that editing, it may occur that I find that I
need to insert a string before the token being examined. I'm having
difficulty doing that, because after I make the insertion, my ranges
appear to be ill-defined.
For instance, I've tried using
tRange.word(i).InsertBefore "abc " where the text of tRange.word(i) is
"defghi" but after the insertion, tRange.words(i).text = "abc de". The
problem is that later on downstream I want examine the "defghi" token
for some further tests, but it no longer exists as
tRange.words(i).text, since that is returned as "abc de"
This is all done in a sub, where I've passed in the index to the word,
and the textrange that contains all the originally selected text. Even
though the new text has now been included in the selection (you can see
that happen in debug), the tRange/index parameters to the sub stil
combine to point to only the first 6 letters of the words(i) token.
I need some way to update the object pointed to by tRange to include
the new expanded selection - is there a way to do that from within the
sub?
text range. As part of that editing, it may occur that I find that I
need to insert a string before the token being examined. I'm having
difficulty doing that, because after I make the insertion, my ranges
appear to be ill-defined.
For instance, I've tried using
tRange.word(i).InsertBefore "abc " where the text of tRange.word(i) is
"defghi" but after the insertion, tRange.words(i).text = "abc de". The
problem is that later on downstream I want examine the "defghi" token
for some further tests, but it no longer exists as
tRange.words(i).text, since that is returned as "abc de"
This is all done in a sub, where I've passed in the index to the word,
and the textrange that contains all the originally selected text. Even
though the new text has now been included in the selection (you can see
that happen in debug), the tRange/index parameters to the sub stil
combine to point to only the first 6 letters of the words(i) token.
From then on, I'm doomed!
I need some way to update the object pointed to by tRange to include
the new expanded selection - is there a way to do that from within the
sub?