inserting text after a table without disturbing adjacent bookmarks/ranges

A

Alex

Hello people,

Here is a problem that got me scratching my head.

The requirements appear simple:
Given a range in a document,
insert some text (say a paragraph mark) after it
without this text bleeding into adjacent bookmarks and/or ranges).

That is, given:
[Range1][Range2]
Should result in:
[Range1]Text[Range2]

(I cannot adjust Range2 after the fact because at the time I may be holding a multitude of ranges that might be affected).

The biggest problem is when the ranges consist of Word tables.

That is:
[Table1][Range2]
Should result in:
[Table1]Text[Range2]

Or, alternatively:
[Range1][Table2]
Should result in:
[Range1]Text[Table2]

Any ideas?


Best wishes,
Alex.
 
D

Doug Robbins

How about Range2.Start = Range2.Start + [length of inserted text]

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
Hello people,

Here is a problem that got me scratching my head.

The requirements appear simple:
Given a range in a document,
insert some text (say a paragraph mark) after it
without this text bleeding into adjacent bookmarks and/or ranges).

That is, given:
[Range1][Range2]
Should result in:
[Range1]Text[Range2]

(I cannot adjust Range2 after the fact because at the time I may be holding
a multitude of ranges that might be affected).

The biggest problem is when the ranges consist of Word tables.

That is:
[Table1][Range2]
Should result in:
[Table1]Text[Range2]

Or, alternatively:
[Range1][Table2]
Should result in:
[Range1]Text[Table2]

Any ideas?


Best wishes,
Alex.
 
A

Alex

Hello Doug,

This is what I am currently doing.

However, this is not an optimal solution since I have to go over *all* the bookmarks (and all the ranges that are currently held) that can possibly be adjacent to my change and check if any of them has to be modified.

Best wishes,
Alex.

Doug Robbins said:
How about Range2.Start = Range2.Start + [length of inserted text]

Hello people,

Here is a problem that got me scratching my head.

The requirements appear simple:
Given a range in a document,
insert some text (say a paragraph mark) after it
without this text bleeding into adjacent bookmarks and/or ranges).

That is, given:
[Range1][Range2]
Should result in:
[Range1]Text[Range2]

(I cannot adjust Range2 after the fact because at the time I may be holding
a multitude of ranges that might be affected).

The biggest problem is when the ranges consist of Word tables.

That is:
[Table1][Range2]
Should result in:
[Table1]Text[Range2]

Or, alternatively:
[Range1][Table2]
Should result in:
[Range1]Text[Table2]

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top