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.
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.
Learn more about Allen...
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:
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 Else ' 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 myRange.Revisions(i).Range.Select bAuthorFound = True Exit For Else 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 cmdFindNext_Click Else ' 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) .Range.Sort ' 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 Selection.SplitTable ' 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.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!