我正在使用一个代码,允许我自动将所有跟踪的更改转换为突出显示的文本。但是,当跟踪更改是抑制时,在我“接受所有修改”之后当然不会突出显示。因此,我正在寻找一个允许我突出显示的代码前 2 个字符和后 2 个字符所有跟踪的更改。然后,在接受所有修改后,我将能够直观地看到哪些地方进行了抑制。
这是我的代码:
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
谢谢
答案1
尝试这个 ...
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