0

I am using a code that allows me to automatically convert all tracked changes to highlighted text. However, when the track change is a suppression, there is of course no highlight after I "Accept All Modifications". Therefore, I am looking for a code that would allow me to highlight 2 characters before and 2 characters after all tracked changes. Then, after accepting all modifications, I would be able to visualize where suppressions have been made.

Here is my code:

Sub tracked_to_highlighted()           
    tempState = ActiveDocument.TrackRevisions
    ActiveDocument.TrackRevisions = False    
    For Each Change In ActiveDocument.Revisions        
        Set myRange = Change.Range
        myRange.Revisions.AcceptAll
        myRange.HighlightColorIndex = wdGreen            
    Next    
    ActiveDocument.TrackRevisions = tempState
End Sub

Thank you

0

Try this ...

Sub tracked_to_highlighted()
    Dim myRange As word.Range
    tempState = ActiveDocument.TrackRevisions
    ActiveDocument.TrackRevisions = False
    For Each Change In ActiveDocument.Revisions
        Set myRange = Change.Range
        myRange.MoveStart word.WdUnits.wdCharacter, Count:=-2
        myRange.MoveEnd word.WdUnits.wdCharacter, Count:=2
        myRange.HighlightColorIndex = wdGreen
        myRange.Revisions.AcceptAll
    Next
    ActiveDocument.TrackRevisions = tempState
End Sub

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.