Table of contents
TOC
Collapse the table of content
Expand the table of content

CellRange Object (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

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

Example

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

Methods

Name
Item
Merge
Select

Properties

Name
Application
Column
Count
Height
Parent
Row
Width
© 2017 Microsoft