Class Cell (PowerPoint VBA)

The class Cell represents a table cell. The Cell object is a member of the CellRange collection. The CellRange collection represents all the cells in the specified column or row. To use the CellRange collection, use the Cells keyword.

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

Dim cll as Cell
Set cll = Dim lngRow As Long: lngRow = 
Dim lngColumn As Long: lngColumn = 
ActiveWindow.RangeFromPoint.Table.Cell(Row:=lngRow, Column:=lngColumn)

The following procedures can be used to set variables of type Cell: CellRange.Item and Table.Cell.

Borders

Returns a Borders collection that represents the borders and diagonal lines for the specified Cell object or CellRange collection.

Dim brdsBorders As Borders
Set brdsBorders = ActiveWindow.RangeFromPoint.Table.Cell.Borders

Merge

Merges one table cell with another. The result is a single table cell.

For the MergeTo parameter, use the syntax .Cell(row, column). This method returns an error if the file name cannot be opened, or the presentation has a baseline.

Merge (MergeTo)

MergeTo: The Cell object to be merged with.

ActiveWindow.RangeFromPoint.Table.Cell.Merge MergeTo:=

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.Cell.Select

Selected

Returns True if the specified table cell is selected.

Dim booSelected As Boolean
booSelected = ActivePresentation.Slides(1).Shapes(2).Table.Cell.Selected

Shape

Returns a Shape object that represents a shape in a table cell.

Dim shpShape As Shape
Set shpShape = ActivePresentation.Slides(1).Shapes(2).Table.Cell.Shape

Split

Splits a single table cell into multiple cells.

Split (NumRows, NumColumns)

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

Arguments

The following arguments are required:

NumRows (Long) - Number of rows that the cell is being split into.

NumColumns (Long) - Number of columns that the cell is being split into.