D
david.f.jenkins
I have a macro that must process each selected paragraph from a PPT
slide. It makes changes to the paragraph text - modifying it by
adding, deleting, or otherwise changing characters in the text.
My approach has been to build a set of all the text ranges in the
selection, and then process these one by one. I run into problems when
I add text to a paragraph (or sentence) - the text for that paragraph
gets shoved to the right by the number of bytes that I'm inserting.
(I'm not absolutely sure of this, but I think he stores the shifted
bytes in a bogus paragraph that he creates. Nevertheless, my original
set of text ranges doesn't contain the new paragraph.)
The bytes that get shifted off aren't lost; if I re-get all the
selected text ranges, everything is there, and refelcts all the changes
up to that point.
As I'm processing, I don't know whether I'm gaining or losing bytes in
a paragraph - it's all driven by the VBScript regex engine.
Here's my problem: if I'm on the nth original text range, and it gets
modified, and then I need to do some further processing with the
right-hand part of the text, I'm screwed - it's gone (as far as that
processing loop is concerned).
So: is there a way to "refresh" the nth textrange from a selection?
Right now I'm having to do some really unnatural acts to refresh the
entire textrange collection without losing my processing place. The
points where I'm doing that help, but there's still no guarantee that I
may not be missing some right-hand text when I apply another regex
replace. I guess I could refresh the entire textrange collection each
time I make a change, but that means I'd have to pass the index of the
current textrange along, instead of the textrange reference itself, and
then get the textrange from the collection each time I have to work on
it.
I see that this rambles, but I've lost a lot of sleep over this in the
last few nights. I hope there's a simple solution someone can point me
to. Thanks for your help.
slide. It makes changes to the paragraph text - modifying it by
adding, deleting, or otherwise changing characters in the text.
My approach has been to build a set of all the text ranges in the
selection, and then process these one by one. I run into problems when
I add text to a paragraph (or sentence) - the text for that paragraph
gets shoved to the right by the number of bytes that I'm inserting.
(I'm not absolutely sure of this, but I think he stores the shifted
bytes in a bogus paragraph that he creates. Nevertheless, my original
set of text ranges doesn't contain the new paragraph.)
The bytes that get shifted off aren't lost; if I re-get all the
selected text ranges, everything is there, and refelcts all the changes
up to that point.
As I'm processing, I don't know whether I'm gaining or losing bytes in
a paragraph - it's all driven by the VBScript regex engine.
Here's my problem: if I'm on the nth original text range, and it gets
modified, and then I need to do some further processing with the
right-hand part of the text, I'm screwed - it's gone (as far as that
processing loop is concerned).
So: is there a way to "refresh" the nth textrange from a selection?
Right now I'm having to do some really unnatural acts to refresh the
entire textrange collection without losing my processing place. The
points where I'm doing that help, but there's still no guarantee that I
may not be missing some right-hand text when I apply another regex
replace. I guess I could refresh the entire textrange collection each
time I make a change, but that means I'd have to pass the index of the
current textrange along, instead of the textrange reference itself, and
then get the textrange from the collection each time I have to work on
it.
I see that this rambles, but I've lost a lot of sleep over this in the
last few nights. I hope there's a simple solution someone can point me
to. Thanks for your help.