Merge Method

Microsoft Publisher Visual Basic

Merges the specified table cell with another cell. The result is a single table cell.

expression.Merge(MergeTo)

expression    Required. An expression that returns a Cell object.

MergeTo   Required Cell object. The cell to be merged with; must be adjacent to the specified cell or an error occurs.

ShowMerge method as it applies to the CellRange object.

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

expression.Merge

expression    Required. An expression that returns a CellRange object; must be a rectangular region of cells or an error occurs.

Example

ShowAs it applies to the 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
        .Rows(1).Cells(1).Merge MergeTo:=.Rows(2).Cells(1)
    End With
End Sub
				

ShowAs it applies to the CellRange object.

This example merges the first two cells in the first two rows of the specified table.

Sub MergeCells()
    ActiveDocument.Pages(1).Shapes(2).Table _
        .Cells(StartRow:=1, StartColumn:=1, _
        EndRow:=2, EndColumn:=2).Merge
End Sub