CellRange Collection [Publisher 2003 VBA Language Reference]

Multiple objects
CellRange
Cell
Multiple objects

A collection of Cell objects in a table column or row. The CellRange collection represents all the cells in the specified column or row.

Using the CellRange Collection

Use the Cells property to return the CellRange collection. This example merges the cells in 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

Use the Count property to return the number of cells in a row, column, table or selection. This example displays a message with the number of cells the specified table.

Sub NumberOfTableCells()
    MsgBox ActiveDocument.Pages(1).Shapes(1).Table _
        .Cells.Count
End Sub

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 with 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 Columns or Rows collections to delete a column or row from a table.

Properties | Application Property | Column Property | Count Property | Height Property | Parent Property | Row Property | Width Property

Methods | Item Method | Merge Method | Select Method

Parent Objects | column | Row | Selection | Table

Child Objects | CellBorder | FillFormat | TextRange