Compartilhar via


Columns.Add Method

Word Developer Reference

Returns a Column object that represents a column added to a table.

Syntax

expression.Add(BeforeColumn)

expression   Required. A variable that represents a Columns collection.

Parameters

Name Required/Optional Data Type Description
BeforeColumn Optional Variant A Column object that represents the column that will appear immediately to the right of the new column.

Return Value
Column

Example

This example creates a table with two columns and two rows in the active document and then adds another column before the first column. The width of the new column is set at 1.5 inches.

Visual Basic for Applications
  Sub AddATable()
    Dim myTable As Table
    Dim newCol As Column
Set myTable = ActiveDocument.Tables.Add(Selection.Range, 2, 2)
Set newCol = myTable.Columns.<strong class="bterm">Add</strong>(BeforeColumn:=myTable.Columns(1))
newCol.SetWidth ColumnWidth:=InchesToPoints(1.5), _
    RulerStyle:=wdAdjustNone

End Sub

See Also