CellRange object (Publisher)
A collection of Cell objects in a table column or row. The CellRange collection represents all the cells in the specified column or row.
Remarks
Although the collection object is named CellRange and is shown in the Object Browser, this keyword is not used in programming the Microsoft Publisher object model. The keyword Cells is used instead.
You cannot programmatically add to or delete individual cells from a Publisher table:
- Use the AddTable method of the Shapes collection to add a new table to a publication.
- Use the Add method of the Columns or Rows collections to add a column or row to a table.
- Use the Delete method of the Column or Row objects to delete a column or row from a table.
Use the Cells property of the Column object to return the CellRange collection.
Use the Count property to return the number of cells in a row, column, table, or selection.
Example
This example merges the cells in the first column of the table.
Sub MergeCellsInFirstColumn()
With ActiveDocument.Pages(1).Shapes(1).Table
.Cells(StartRow:=1, StartColumn:=1, _
EndRow:=.Rows.Count, EndColumn:=1).Select
End With
Selection.TableCellRange.Merge
End Sub
This example displays a message with the number of cells in the specified table.
Sub NumberOfTableCells()
MsgBox ActiveDocument.Pages(1).Shapes(1).Table _
.Cells.Count
End Sub
Methods
Properties
See also
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.