Copying text between tables using VBA

E

Ed

I'm trying to make sure a group of tables all have the same headers. So
after formatting one table, I'm copying all the pertinent attribute over in
a macro. The text, though, is giving me a bit of a problem - an extra
paragraph mark. I'm using
tab2.Cell(1, 1).Range.Text = tab1.Cell(1, 1).Range.Text
and always get the text plus a paragraph mark. Any suggestions that would
save me from going back to every table and deleting the paragraph mark?

Ed
 
C

Cindy M -WordMVP-

Hi Ed,
I'm trying to make sure a group of tables all have the same headers. So
after formatting one table, I'm copying all the pertinent attribute over in
a macro. The text, though, is giving me a bit of a problem - an extra
paragraph mark. I'm using
tab2.Cell(1, 1).Range.Text = tab1.Cell(1, 1).Range.Text
and always get the text plus a paragraph mark. Any suggestions that would
save me from going back to every table and deleting the paragraph mark?
There is always a Chr$(13)&Chr$(7) pair of characters at the end of every
table cell. You can't get rid of them, they're part of the table structure,
and store important formatting and layout information. (Well, actually what
they store is a pointer to an internal table with the information.)

You need to trim the last two characters from any string you pick up from
Range.Text in a table cell, which you can do with a combination of the Left
and Len functions.

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 :)
 

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