Share via


Subdocuments.Merge Method

Word Developer Reference

Merges the specified subdocuments of a master document into a single subdocument.

Syntax

expression.Merge(FirstSubdocument, LastSubdocument)

expression   Required. A variable that represents a Subdocuments collection.

Parameters

Name Required/Optional Data Type Description
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.

Example

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

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

See Also