Partager via


Column Object (PowerPoint)

Represents a table column. The Column object is a member of the Columns collection. The Columns collection includes all the columns in a table.

Example

Use Columns(index) to return a single Column object. Index represents the position of the column in the Columns collection (usually counting from left to right; although the TableDirection property can reverse this). This example selects the first column of the table in shape five on the second slide.

ActivePresentation.Slides(2).Shapes(5).Table.Columns(1).Select

Use the Cell object to indirectly reference the Column object. This example deletes the text in the first cell (row 1, column 1), inserts new text, and then sets the width of the entire column to 110 points.

With ActivePresentation.Slides(2).Shapes(5).Table.Cell(1, 1)

    .Shape.TextFrame.TextRange.Delete

    .Shape.TextFrame.TextRange.Text = "Rooster"

    .Parent.Columns(1).Width = 110

End With

Use the Add method to add a column to a table. This example creates a column in an existing table and sets the column width to 72 points (one inch).

With ActivePresentation.Slides(2).Shapes(5).Table

    .Columns.Add.Width = 72

End With

Use the Cells property to modify the individual cells in a Column object. This example selects the first column in the table and applies a dashed line style to the bottom border.

ActiveWindow.Selection.ShapeRange.Table.Columns(1) _

    .Cells.Borders(ppBorderBottom).DashStyle = msoLineDash

See Also

Concepts

Column Object Members

PowerPoint Object Model Reference