Create tables

L

Lasse

Hi

I need to create a macro that inserts a table with 3 columns and 4 rows. The
problem is not creating the table with 3 columns and 4 rows, the problem is
how to define the size (or column width) of each column.
If I try to record a new macro I am not allowed to change the table
properties.

Does anyone have a solution to this problem?
 
D

David Sisson

Hi Lasse,

Sub SetupTable()

Dim aDoc As Document
Dim aTable As Table

Set aDoc = ActiveDocument

Set aTable = aDoc.Tables.Add(Range:=Selection.Range, NumRows:=5,
NumColumns:=5)

With aTable
.Columns(1).Width = InchesToPoints(1.75)
.Columns(2).Width = InchesToPoints(1.5)
.Columns(3).Width = InchesToPoints(1.25)
.Columns(4).Width = InchesToPoints(1)
.Columns(5).Width = InchesToPoints(1.5)
End With

End Sub
 

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