Finding most recent addition to document

  • Thread starter Thread starter karlengel
  • Start date Start date
K

karlengel

I'm using Track Changes on a very long document in Word 97, where
various lines are being added to points throughout at various times.
Is there a way I can quickly find the most recent addition, or an
addition made on a known date?
 
Hi Karl,

You could use a macro like the following to find the most recent revision.

Sub FindLastRevision()
Dim iRev As Integer
With ActiveDocument
If .Revisions.Count > 0 Then
iRev = 1
For i = 1 To .Revisions.Count
If .Revisions(i).Date > .Revisions(iRev).Date Then
iRev = i
End If
Next
MsgBox .Revisions(iRev).Range.Text & vbCrLf &
..Revisions(iRev).Date
.Revisions(iRev).Range.Select
End If
End With
End Sub

Note that the code fails if a revision in a table updated just part of the
row, with a "Runtime error '5852' - Requested object is not available"
message. I'm not sure how to code around that, since accessing any of the
affected revision's properties seems to have the same effect. Everything
works fine if the whole row was updated, though.

Cheers
 
Since posting the previous reply I've found that the Runtime error '5852'
occurs when both of the following conditions are true:
• A paragraph formatting change was made inside a table.
• A formatting change was made to an end-of-row marker in a table.
MS released fixes for both Word 2002 and 2003 but not, apparently, Word
2000. MSKB articles 837108 and 841539 refer.

Cheers
 
Back
Top