Class Column (PowerPoint VBA)

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

Set

To use a Column class variable it first needs to be instantiated, for example

Dim clm as Column
Set clm = ActiveWindow.RangeFromPoint.Table.Columns(Index:=1)

The following procedures can be used to set variables of type Column: Columns.Item, Columns.Add and Table.Columns

Cells

Returns a CellRange collection that represents the cells in a table column or row.

Dim creCells As CellRange
Set creCells = ActivePresentation.Slides(1).Shapes(2).Table.Columns(1).Cells

Delete

Deletes the specified Column object.

Attempting to delete the only existing column in a table will result in a run-time error.

ActiveWindow.RangeFromPoint.Table.Columns(1).Delete

Parent

Returns the parent object for the specified object.

Select

Selects the specified object.

If you try to make a selection that isn't appropriate for the view, your code will fail. For example, you can select a slide in slide sorter view but not in slide view.

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

Width

Returns or sets the width of the specified object, in points.

ActivePresentation.Slides(1).Shapes(2).Table.Columns(1).Width = 150

Columns.Add

Adds a new column to an existing table. Returns a Column object that represents the new table column.

The value of the BeforeColumn parameter must be between 1 and the number of columns in the table, inclusive. The default value is -1, which means that if you omit the BeforeColumn parameter, the new column is added as the last column in the table.

Syntax : expression.Add (BeforeColumn)

BeforeColumn: The index number that specifies the table column before which the new column will be inserted.

Dim clm As Column
Set clm = ActiveWindow.RangeFromPoint.Table.Columns.Add()

Columns.Count

Returns the number of objects in the specified collection.

Dim lngCount As Long
lngCount = ActivePresentation.Slides(1).Shapes(2).Table.Columns.Count

Columns.Item

Returns a single Column object from the specified Columns collection.

Syntax : expression.Item (Index)

Index: The index number of the single Column object in the collection to be returned.

Dim clm As Column
Set clm = ActiveWindow.RangeFromPoint.Table.Columns(Index:=1)

Columns.Parent

Returns the parent object for the specified object.