Merge Method Example

This example merges the first two cells in table one in the active document with one another and then removes the table borders.

If ActiveDocument.Tables.Count >= 1 Then
    With ActiveDocument.Tables(1)
        .Cell(Row:=1, Column:=1).Merge _
            MergeTo:=.Cell(Row:=1, Column:=2)
        .Borders.Enable = False
    End With
End If

This example merges changes from Sales1.doc into Sales2.doc (the active document).

If InStr(1, ActiveDocument.Name, "sales2.doc", 1) Then _
    ActiveDocument.Merge FileName:="C:\Docs\Sales1.doc"

This example merges the cells in row one of the selection into a single cell and then applies shading to the row.

If Selection.Information(wdWithInTable) = True Then
    Set myrow = Selection.Rows(1)
    myrow.Cells.Merge
    myrow.Shading.Texture = wdTexture10Percent
End If

This example merges the first and second subdocuments in the active document into one subdocument.

If ActiveDocument.Subdocuments.Count >= 2 Then
    Set aDoc = ActiveDocument
    aDoc.Subdocuments.Merge _
        FirstSubdocument:=aDoc.Subdocuments(1), _
        LastSubdocument:=aDoc.Subdocuments(2)
End If