Hi =?Utf-8?B?UkJsdW5kZW4=?=,
I have a table of labels I want to print, but I want to add a piece of text
to each cell. What macro commands do I use to say 'in each cell paste from
clipboard'?
Is there an array or do I select the whole table and use a 'for each item'?
How "efficiently" this can be accomplished depends to a certain extent on the
version of Word you have. There is no built-in way to pick up the table in an
array. Although it would be possible, you might run into more problems than
it's worth if you have to maintain formatting or special characters.
The simplest thing to program would be to "walk" each cell in the table.
Assuming what you want to paste should go at the end of each cell, in a new
line, something like this:
Dim tbl as Word.Table
Dim cel as Word.Cell
Dim rng as Word.Range
Set tbl = ActiveDocument.Tables(1)
For Each cel in tbl.Range.Cells
Set rng = cel.Range
rng.Collapse wdCollapseEnd
rng.Paste
Next
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail
