Compare Three or More Word Documents (*. Docx)

Compare Three or More Word Documents (*. Docx)

I've seen multiple questions and answers for how to compare two Word documents, and I've seen some questions and answers for how to compare three or more raw text files, but I'm struggling to find a method to compare three or more Word documents.

I don't need the formatting compared, and I don't mind if I can't edit them or merge them, but I would like to be able to see the files' differences highlighted. I know I can copy the text into text files and use that in raw-text-only diff tools, but some of the Word docs I need to compare are quite large.

2

2 Answers

The software has the option to do a 3-way File Comparison. Link to screenshot.

There are some Plugins available that might help you with the Word part of your question.

However, comparing text is probably most performant.

There is not a way that I know of to compare more than two documents at a time, onscreen side by side.

If you have multiple revision documents you can combine them into one new document, but you probably are already aware of that feature.

If you have multiple revision documents and you want to "automate" the process a bit to cut down on some of the manual input you have to do, you can use a macro like the one below.

Sub CompareDocs()
    Dim doc As word.Document, iDoc As word.Document, rDoc As word.Document
    Dim selFiles() As String, strFolderPath As String
    Dim Sep As String, i As Long
    On Error GoTo errHandler

    Sep = Application.PathSeparator
    Set doc = ActiveDocument
    Application.ScreenUpdating = False
    With Application.FileDialog(msoFileDialogFilePicker)
        .Title = "Select the files to compare to your source document"
        .InitialFileName = curDir
        .AllowMultiSelect = True
        If .Show = 0 Then
            Exit Sub
        End If
        ReDim Preserve selFiles(.SelectedItems.Count - 1)
        strFolderPath = Left(.SelectedItems(1), InStrRev(.SelectedItems(1), Sep))
        For i = 0 To .SelectedItems.Count - 1
            selFiles(i) = .SelectedItems(i + 1)
        Next
    End With
    For i = 0 To UBound(selFiles)
        Set iDoc = Documents.Open(selFiles(i))
        Set rDoc = Application.CompareDocuments(OriginalDocument:=doc, RevisedDocument:=iDoc, _
        CompareFormatting:=False, CompareComments:=False)
        rDoc.SaveAs2 strFolderPath & "Compared_" & iDoc.Name
        rDoc.Close
        iDoc.Close
    Next
    Application.ScreenUpdating = True
    MsgBox "Document Compares Complete"
    Exit Sub
errHandler:
    MsgBox Err.Description, vbCritical, "Compare Docs"
    Err.Clear
    Application.ScreenUpdating = True
End Sub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.