Column object (Publisher)
Represents a single table column. The Column object is a member of the Columns collection. The Columns collection includes all the columns in a table, selection, or range.
Use Columns (index), where index is the column number, to return a single Column object. The index number represents the position of the column in the Columns collection (counting from left to right).
Use the Item method of a Columns collection to return a Column object.
Use the Delete method to delete a column from a table.
This example selects column three in the first shape in the active publication. It assumes that the first shape is a table and not another type of shape.
Sub SelectColumn()
ActiveDocument.Pages(2).Shapes(1).Table.Columns(3).Cells.Select
End Sub
This example enters text into the first cell of the third column of the specified table and formats the text with a bold, 15-point font. It assumes that the first shape is a table and not another type of shape.
Sub ColumnHeading()
With ActiveDocument.Pages(2).Shapes(1).Table.Columns(3) _
.Cells(1).Text
.Text = "Sales"
.Font.Bold = msoTrue
.Font.Size = 15
End With
End Sub
This example deletes the column added in the previous example.
Sub DeleteColumn()
ActiveDocument.Pages(2).Shapes(1).Table.Columns(3).Delete
End Sub
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.