Muokkaa

Jaa


Columns.Add method (Word)

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.

Sub AddATable() 
 Dim myTable As Table 
 Dim newCol As Column 
 
 Set myTable = ActiveDocument.Tables.Add(Selection.Range, 2, 2) 
 Set newCol = myTable.Columns.Add(BeforeColumn:=myTable.Columns(1)) 
 newCol.SetWidth ColumnWidth:=InchesToPoints(1.5), _ 
 RulerStyle:=wdAdjustNone 
End Sub

See also

Columns Collection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.