Cell Object (Publisher)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Represents a single table cell. The Cell object is a member of the CellRange collection. The CellRange collection represents all the cells in the specified object.

Use Cells(index), where index is the cell number, to return a Cell object. This example merges the first two cells of the first column of the specified table.

Sub MergeCell() 
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(1) 
 .Cells(1).Merge MergeTo:=.Cells(2) 
 End With 
End Sub

This example applies a thick border around the first cell in the second column of the specified table.

Sub OutlineBorderCell() 
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(2).Cells(1) 
 .BorderLeft.Weight = 5 
 .BorderRight.Weight = 5 
 .BorderTop.Weight = 5 
 .BorderBottom.Weight = 5 
 End With 
End Sub