Merges the specified subdocuments of a master document into a single subdocument.
expression.Merge(FirstSubdocument, LastSubdocument)
expression Required. An expression that returns one of the above objects.
FirstSubdocument Optional Variant. The path and file name of the original document you want to merge revisions with.
LastSubdocument Optional Variant. The last subdocument in a range of subdocuments to be merged.
Merge method as it applies to the Cell object.
Merges the specified table cell with another cell. The result is a single table cell.
expression.Merge(MergeTo)
expression Required. An expression that returns one of the above objects.
MergeTo Required Cell object. The cell to be merged with.
Merge method as it applies to the Document object.
Merges the changes marked with revision marks from one document to another.
expression.Merge(Name, MergeTarget, DetectFormatChanges, UseFormattingFrom, AddToRecentFiles)
expression Required. An expression that returns one of the above objects.
Name Required String.
MergeTarget Optional WdMergeTarget.
WdMergeTarget can be one of these WdMergeTarget constants. |
wdMergeTargetCurrent default |
wdMergeTargetSelected |
wdMergeTargetNew |
DetectFormatChanges Optional Boolean.
UseFormattingFrom Optional WdUseFormattingFrom.
WdUseFormattingFrom can be one of these WdUseFormattingFrom constants. |
wdFormattingFromPrompt default |
wdFormattingFromCurrent |
wdFormattingFromSelected |
AddToRecentFiles Optional Boolean.
Merge method as it applies to the Cells object.
Merges the specified table cells with one another. The result is a single table cell.
expression.Merge
expression Required. An expression that returns one of the above objects.
Example
As it applies to the Cell object.
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
As it applies to the Document object.
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"
As it applies to the Cells object.
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
As it applies to the Subdocuments object.
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