Highlighting all tracked changes in a document

N

newsgroups

Dear all,

Could anyone here advice me how add the marking of deletions to the following macro (found on the web)? Now it only marks insertions. I'd also like to speed this macro up using range objects, but don't know how. Here's the macro I found:

Dim i As Long
Dim iMax As Long
Dim bAccept As Boolean ' Set this to True if you want to accept revision

ActiveDocument.TrackRevisions = False
' ----------------------------
' Set bAccept = True if Insertions to be Accepted
' ----------------------------
bAccept = False
' ----------------------------

iMax = ActiveDocument.Revisions.Count
For i = 1 To iMax
If i > iMax Then Exit For
Debug.Print ActiveDocument.Revisions(i).Type
If ActiveDocument.Revisions(i).Type = wdRevisionInsert Then
ActiveDocument.Revisions(i).Range.HighlightColorIndex = wdYellow
If bAccept = True Then
ActiveDocument.Revisions(i).Accept
i = i - 1
iMax = iMax - 1
End If
End If
Next i
ActiveDocument.TrackRevisions = True

End Sub
===============
Kind regards,
S.
 
S

Stefan Blom

Changing the line

If ActiveDocument.Revisions(i).Type = wdRevisionInsert Then

to

If ActiveDocument.Revisions(i).Type = wdRevisionInsert Or _
If ActiveDocument.Revisions(i).Type = wdRevisionDelete Then

should do what you want.

--
Stefan Blom
Microsoft Word MVP




in message
Dear all,

Could anyone here advice me how add the marking of deletions to the following
macro (found on the web)? Now it only marks insertions. I'd also like to speed
this macro up using range objects, but don't know how. Here's the macro I found:

Dim i As Long
Dim iMax As Long
Dim bAccept As Boolean ' Set this to True if you want to accept revision

ActiveDocument.TrackRevisions = False
' ----------------------------
' Set bAccept = True if Insertions to be Accepted
' ----------------------------
bAccept = False
' ----------------------------

iMax = ActiveDocument.Revisions.Count
For i = 1 To iMax
If i > iMax Then Exit For
Debug.Print ActiveDocument.Revisions(i).Type
If ActiveDocument.Revisions(i).Type = wdRevisionInsert Then
ActiveDocument.Revisions(i).Range.HighlightColorIndex = wdYellow
If bAccept = True Then
ActiveDocument.Revisions(i).Accept
i = i - 1
iMax = iMax - 1
End If
End If
Next i
ActiveDocument.TrackRevisions = True

End Sub
===============
Kind regards,
S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top