Application.MergeDocuments (Word)

Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.

MergeDocuments (OriginalDocument, RevisedDocument, Destination, Granularity, CompareFormatting, CompareCaseChanges, CompareWhitespace, CompareTables, CompareHeaders, CompareFootnotes, CompareTextboxes, CompareFields, CompareComments, CompareMoves, OriginalAuthor, RevisedAuthor, FormatFrom)


Dim docMergeDocuments As Document
Set docMergeDocuments = Application.MergeDocuments(OriginalDocument:=, RevisedDocument:=)

Arguments

The following arguments are required:

OriginalDocument (Document) - Specifies the path and file name of the original document.

RevisedDocument (Document) - Specifies the path and file name of the revised document to which to compare the original document.

Optional arguments

The following arguments are optional

Destination (WdCompareDestination) - Specifies whether to create a new file or whether to mark the differences between the two documents in the original document or in the revised document. Default value is wdCompareDestinationNew.

Possible return values are wdCompareDestinationNew - Creates a new file and tracks the differences between the original document and the revised document using tracked changes, wdCompareDestinationOriginal - Tracks the differences between the two files using tracked changes in the original document, wdCompareDestinationRevised - Tracks the differences between the two files using tracked changes in the revised document.

Granularity (WdGranularity) - Specifies whether changes are tracked by character or by word. Default value is wdGranularityWordLevel.

Possible return values are wdGranularityCharLevel - Tracks character-level changes, wdGranularityWordLevel - Tracks word-level changes.

CompareFormatting (Boolean) - Specifies whether to mark differences in formatting between the two documents. Default value is True.

CompareCaseChanges (Boolean) - Specifies whether to mark differences in case between the two documents. Default value is True.

CompareWhitespace (Boolean) - Specifies whether to mark differences in white space, such as paragraphs or spaces, between the two documents. Default value is True.

CompareTables (Boolean) - Specifies whether to compare the differences in data contained in tables between the two documents. Default value is True.

CompareHeaders (Boolean) - Specifies whether to compare differences in headers and footers between the two documents. Default value is True.

CompareFootnotes (Boolean) - Specifies whether to compare differences in footnotes and endnotes between the two documents. Default value is True.

CompareTextboxes (Boolean) - Specifies whether to compare differences in the data contained within text boxes between the two documents. Default value is True.

CompareFields (Boolean) - Specifies whether to compare differences in fields between the two documents. Default value is True.

CompareComments (Boolean) - Specifies whether to compare differences in comments between the two documents. Default value is True.

CompareMoves - Boolean

OriginalAuthor (String) - Specifies the name of the author of the original document.

RevisedAuthor (String) - Specifies the name of the person to use for unattributed changes after merging two documents.

FormatFrom (WdMergeFormatFrom) - Specifies the document from which to retain formatting.

Possible return values are wdMergeFormatFromOriginal - Retains formatting from the original document, wdMergeFormatFromPrompt - Prompt the user for the document to use for formatting, wdMergeFormatFromRevised - Retains formatting from the revised document.