Finding Changes by Editor

by Allen Wyatt
(last updated October 1, 2014)

Subscriber Doris Bell asked if there was a way, in Word 2000, to locate all the changes made by a particular editor in a document that has Track Changes turned on. The quick answer, of course, would be to upgrade to Word 2002, since this capability is available right from the Reviewing toolbar.

Word 97 and Word 2000, however, are a different story--there you only have the capability to view or not view all tracked changes. If desired, you can address the deficiency by creating macros that allow you to search for changes by a specific editor. Start by creating a user form in the VBA Editor, by following these general steps:

  1. Display the VBA Editor by pressing Alt+F11.
  2. Choose UserForm from the Insert menu. A blank user form is displayed in the editor.
  3. Using the Toolbox, place a Label control in the form, near the left side of the form.
  4. In the Properties for the newly placed Label control, change the Caption property to "Author" (without the quotes).
  5. Using the Toolbox, place a ComboBox control just to the right of the label you placed in step 3.
  6. In the Properties for the ComboBox control, change the Name property to "cboAuthor" (without the quotes).
  7. Using the Toolbox, place a CommandButton control on the form. This can be along the bottom edge of the form, or on the right edge; it is up to you.
  8. In the Properties for the CommandButton control, change the Name property to "cmdFindNext" (without the quotes).
  9. In the Properties for the CommandButton control, change the Caption property to "Find" (without the quotes).
  10. Using the Toolbox, place another CommandButton control on the form. This should be either just to the right of the other CommandButton control, or just below it.
  11. In the Properties for the CommandButton control, change the Name property to "cmdExit" (without the quotes).
  12. In the Properties for the CommandButton control, change the Caption property to "Exit" (without the quotes).
  13. Resize your overall form for the desired appearance.

Your form is now complete, and all you need to do is add the programming code that will take advantage of these controls. Make sure you select the entire form, and then press F7 to display the Code window. If there is any code already there (VBA may provide some default code for you), feel free to delete it. Then, place the following code in the Code window:

Private Sub UserForm1_Initialize()
    Dim oRevision As Revision
    Dim bExists As Boolean

    bExists = False

    ' Go to beginning of document
    Selection.HomeKey Unit:=wdStory

    ' Loop through revisions and add authors
    For Each oRevision In ActiveDocument.Revisions
        If Me.cboAuthor.ListCount > 0 Then
            For i = 1 To Me.cboAuthor.ListCount
                If Me.cboAuthor.List(i - 1) = oRevision.Author Then
                    bExists = True
                End If
            Next i

            ' If it doesn't already exist, add the author to list
            If Not bExists Then
                Me.cboAuthor.AddItem oRevision.Author
            End If

            bExists = False
            ' Add first Author to the list
            Me.cboAuthor.AddItem oRevision.Author
        End If
    Next oRevision
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdFindNext_Click()

    Dim iStart As Integer
    Dim iEnd As Integer
    Dim myRange As Range
    Dim iRevisions As Integer
    Dim iResponse As Integer
    Dim bAuthorFound As Boolean

    ' Collapse the Selection so that we don't include selected text
    Selection.Collapse wdCollapseEnd
    Selection.MoveRight wdCharacter, 2

    ' Get the Range start and end positions
    iStart = Selection.Range.Start
    iEnd = ActiveDocument.Content.End
    Set myRange = ActiveDocument.Range(Start:=iStart, End:=iEnd)

    ' Count total number of revisions within range
    iRevisions = myRange.Revisions.Count

    If iRevisions > 0 Then
        ' Loop through all revisions in the range 
        ' selecting first one found
        For i = 1 To iRevisions
            If myRange.Revisions(i).Author = Me.cboAuthor.Text Then
                bAuthorFound = True
                Exit For
                bAuthorFound = False
            End If
        Next i
    End If

    If Not bAuthorFound Then
        ' Ask if they would like to start from the beginning
        iResponse = MsgBox("Search from beginning?", vbYesNo, "Find Author")
        If iResponse = vbYes Then
            ' Go to top of document
            Selection.HomeKey Unit:=wdStory
            ' Exit
            Unload Me
        End If
    End If
End Sub

When you later run your new user form, you are presented with a way to select editors and find the next edit made by that editor. This allows you to find one edit at a time, not to view all the edits by a particular editor (as you can in Word 2002).

There is a different approach you can take. You could use a macro to "pull" all the edits done in a document, and arrange them by editor in a new document. The following macro shows how you can do this sort of thing. The resulting table even indicates the type of edit done in the original document.

Option Explicit

Private Sub ShowAuthorAndRevisions()
    Dim sRevision As String
    Dim oRev As Revision
    Dim oDoc As Document
    Dim oRng As Range

    For Each oRev In ActiveDocument.Revisions
        With oRev
            sRevision = sRevision & .Author & vbTab _
              & .Type & vbTab & .Range.Text & vbCrLf
        End With
    Next oRev

    ' Open a new document
    Set oDoc = Documents.Add
    With oDoc
        .Range.InsertAfter sRevision
        ' Convert the revisions to a table
        .Range.ConvertToTable Separator:=wdSeparateByTabs
        With .Tables(1)
            ' Sort the table by the author (i.e., the first column)
            ' Add a new row to the beginning of the table
            .Range.Rows.Add BeforeRow:=.Range.Rows(1)
            With .Rows(1)
                ' insert column descriptions
                .Cells(1).Range.Text = "Author"
                .Cells(2).Range.Text = "Revision Type"
                .Cells(3).Range.Text = "Revision"
            End With
        End With
        ' insert a paragraph mark above the table
        ' Insert a legend to make reading the revision type easier
        .Range.InsertBefore "Revision Type Legend:" & vbCrLf & _
            "No Revision = 0 " & vbCrLf & _
            "Revision Insert = 1 " & vbCrLf & _
            "Revision Delete = 2 " & vbCrLf & _
            "Revision Property = 3 " & vbCrLf & _
            "Revision Paragraph Number = 4 " & vbCrLf & _
            "Revision Display Field = 5 " & vbCrLf & _
            "Revision Reconcile = 6 " & vbCrLf & _
            "Revision Conflict = 7 " & vbCrLf & _
            "Revision Style = 8 " & vbCrLf & _
            "Revision Replace = 9 " & vbCrLf
    End With
End Sub

For each revision in a document, this macro will find the revision's author, type, and text (if any). The macro will then place all the revisions in a table, sort the table by the name of the author, and insert a small legend that describes each revision type.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1303) applies to Microsoft Word 97, 2000, and 2002.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Specifying Location for a Message Box

When writing macros, you may want to position a message box at a specific location on the screen. This can't be done in ...

Discover More

Extracting Pictures from a Document

Word allows you to easily insert pictures into your documents. Getting the pictures back out of your documents can be another ...

Discover More

Turning Off Capital Corrections

Tired of having Excel second-guess you when you type a word that starts with two capital letters? You can turn off this ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!


Changing the Office Assistant

How to change the Office Assistant character in Word.

Discover More

Changing Label Printing Order

If you want to change the order in which labels are printed when doing a mail merge, Word doesn't provide many options. This ...

Discover More

Displaying Quick Document Statistics

Need to see how many pages, words, paragraphs, or lines are in your document? Word makes it easy to retrieve such ...

Discover More

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.


FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing