Insert Column in a Table

R

Ron

Hello all,

My first attempt to do a Word macro. I've done Excel macros, but
never Word. I'm trying to insert two columns in a table in a Word
document. Any assistance appreciated.... thank you, Ron
 
N

NOPIK

never Word.  I'm trying to insert two columns in a table in a Word
document.  Any assistance appreciated.... thank you, Ron
It deeply depends on your table format.
Word doesn't have tables - they are just formatted cells, so, no
actual rows or columns - only adjacent cells.
If your your table is square, and user don't alter it by inserting,
joining, or drawing cells - you can use Rows and Columns methods of
the table.
Tables(MyTable).ColumnsAdd(2)
 
G

Graham Mayor

Dim oTable As Table
Set oTable = ActiveDocument.Tables(1) 'for the first table in the
document
'or
'Set oTable = Selection.Tables(1) 'for the selected table
oTable.Columns(2).Select 'the second column
With Selection 'insert two columns to the right
.InsertColumnsRight
.InsertColumnsRight
End With
 

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