macro to copy text

A

akiwi

Hi

Is it possible to create a macro to do this?

I have a table with the left hand column containing sequential numbers
say 1 to 100 (i.e. 100 rows). The next column has a name associated
with that number. There is a later section in the document associated
with each of those names and in that section there is a table
containing the same name (or shortened version of it) and the
associated number.

At some stage, the numbers in the main table may change e.g. if a
line is added or deleted at row 50 then the numbers following go up or
down by one - the number in each of the individual sections also
then has to go up or down by one so that it is the same as the number
associated with the name back in the main table. Updating the numbers
in the main table is fairly easy (I think), but having updated them
(e.g. by copying from somewhere) I need to run a macro on each row of
the table to update the "remote" numbers.

I can create a bookmark back in the main table to link to the number
in the later part of the document but to get to the destination of the
bookmark you have to do CTRL Click in the main table - which doesn't
work during macro recording.

I would prefer not to use "linked text" and paste special because the
link seems to get lost fairly easily e.g. if you overwrite it with a
new number, say by regenerating the entire column of numbers by
copying in from Excel.

Thanks for any suggestions.

Graeme
 
H

Helmut Weber

Hi,

a matter of logic rather than programming.
As I am no good at fields and related topics
of document automation, I'd try it this way.

Case 1
Insert one or more empty rows in table x.
Insert the text you like.
Leave the cell for the numbering empty.
Check wich cells in column 1 are empty
Get e.g. Selection.Information(wdEndOfRangeRowNumber)
You know then, where a row was inserted
e.g. rows 7 9 and 12 are new rows
Insert new rows in table y after line 6,
after line, 8 and after line 11.
Transfer the text
Renumber both tables (column 1).

Case 2:
One or more rows deleted:
Then there are numbers missing.
If the numbering starts with 3,
then rows 1 and 2 where deleted
If there are breaks in numbering,
then the "gap" rows where deleted.
If there are no gaps, but the number of rows
in table x is smaller then in table y, then
there were rows deleted from the end of
table x ...
Delete then rows with the numbers so achieved
in table y...

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
G

Graeme Prentice

I think I didn't explain what I needed very well, but thanks for taking
the trouble to reply.

Graeme
 

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