This documentation is archived and is not being maintained.

Document.Compare Method

Office 2007
Displays revision marks that indicate where the specified document differs from another document.


expression.Compare(Name, AuthorName, CompareTarget, DetectFormatChanges, IgnoreAllComparisonWarnings, AddToRecentFiles, RemovePersonalInformation, RemoveDateAndTime)

expression   Required. A variable that represents a Document object.


NameRequired/OptionalData TypeDescription
NameRequiredStringThe name of the document with which the specified document is compared.
AuthorNameOptionalVariantThe reviewer name associated with the differences generated by the comparison. If unspecified, the value defaults to the author name of the revised document or the string "Comparison" if no author information is present.
CompareTargetOptionalVariantThe target document for the comparison. Can be any WdCompareTarget constant.
DetectFormatChangesOptionalBooleanTrue (default) for the comparison to include detection of format changes.
IgnoreAllComparisonWarningsOptionalVariantTrue compares the documents without notifying a user of problems. The default value is False.
AddToRecentFilesOptionalVariantTrue adds the document to the list of recently used files on the File menu.
RemovePersonalInformationOptionalBooleanTrue removes all user information from comments, revisions, and the properties dialog box in the returned Document object . The default value is False.
RemoveDateAndTimeOptionalBooleanTrue removes date and time stamp information from tracked changes in the returned Document object. The default value is False.


This example compares the active document with the document named "FirstRev.doc" in the Draft folder and places the comparison differences in a new document.

Visual Basic for Applications
Sub CompareDocument()
    ActiveDocument.Compare Name:="C:\Draft\FirstRev.doc", _
End Sub