Application.CompareDocuments method (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.
Syntax
expression. CompareDocuments
( _OriginalDocument_
, _RevisedDocument_
, _Destination_
, _Granularity_
, _CompareFormatting_
, _CompareCaseChanges_
, _CompareWhitespace_
, _CompareTables_
, _CompareHeaders_
, _CompareFootnotes_
, _CompareTextboxes_
, _CompareFields_
, _CompareComments_
, _CompareMoves_
, _RevisedAuthor_
, _IgnoreAllComparisonWarnings_
)
expression An expression that returns an Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
OriginalDocument | Required | Document | Specifies the path and file name of the original document. |
RevisedDocument | Required | Document | Specifies the path and file name of the revised document to which to compare the original document. |
Destination | Optional | 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. |
Granularity | Optional | WdGranularity | Specifies whether changes are tracked by character or by word. Default value is wdGranularityWordLevel. |
CompareFormatting | Optional | Boolean | Specifies whether to mark differences in formatting between the two documents. Default value is True. |
CompareCaseChanges | Optional | Boolean | Specifies whether to mark differences in case between the two documents. Default value is True. |
CompareWhitespace | Optional | Boolean | Specifies whether to mark differences in white space, such as paragraphs or spaces, between the two documents. Default value is True. |
CompareTables | Optional | Boolean | Specifies whether to compare the differences in data contained in tables between the two documents. Default value is True. |
CompareHeaders | Optional | Boolean | Specifies whether to compare differences in headers and footers between the two documents. Default value is True. |
CompareFootnotes | Optional | Boolean | Specifies whether to compare differences in footnotes and endnotes between the two documents. Default value is True. |
CompareTextboxes | Optional | Boolean | Specifies whether to compare differences in the data contained within text boxes between the two documents. Default value is True. |
CompareFields | Optional | Boolean | Specifies whether to compare differences in fields between the two documents. Default value is True. |
CompareComments | Optional | Boolean | Specifies whether to compare differences in comments between the two documents. Default value is True. |
CompareMoves | Optional | Boolean | Specifies whether to compare differences in moves between the two documents. Default value is True. |
RevisedAuthor | Optional | String | Specifies the name of the person to whom to attribute changes when comparing the two documents. |
IgnoreAllComparisonWarnings | Optional | Boolean | Specifies whether to ignore warnings when comparing the two documents. |
Return value
Document
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기