使用移动格式将跟踪的更改转换为MS Word中的文本

时间:2016-07-22 18:16:41

标签: ms-word

我正在尝试将跟踪的更改转换为格式化文本。我在@CindyMeister下面有一个非常棒的宏,但它不能处理移动更改(移动时为绿色双删除线,移动时为绿色双下划线)。我添加了移动和移动的行,但似乎无法弄清楚如何保持绿色文本颜色。有谁知道如何更新宏来修复它?

Sub FormatRevisions()
    Dim doc As Word.Document
    Dim rev As Word.Revision

    Set doc = ActiveDocument
    doc.TrackRevisions = False
    For Each rev In doc.Revisions
        Select Case rev.Type
            Case wdRevisionMovedFrom
                rev.Range.Font.DoubleStrikeThrough = True
                rev.Reject
            Case wdRevisionMovedTo
                rev.Range.Underline = wdUnderlineDouble
                rev.Accept
            Case wdRevisionDelete
                rev.Range.Font.StrikeThrough = True
                rev.Reject
            Case wdRevisionInsert
                rev.Range.Underline = wdUnderlineSingle
                rev.Accept
            Case wdRevisionFormat
                 MsgBox "revision format"
                rev.Accept
            Case wdRevisionStyle
                 MsgBox "revision style"
                rev.Accept
            Case wdRevisionStyleDefinition
                 MsgBox "revision style def"
                rev.Accept
            Case wdRevisionSectionProperty
                 MsgBox "revision section prop"
                rev.Accept
            Case wdRevisionReplace
                 MsgBox "revision replace"
                rev.Accept
            Case wdRevisionTableProperty
                 MsgBox "revision table property"
                rev.Accept
            Case wdRevisionReconcile
                 MsgBox "revision reconcile"
                rev.Accept
            Case wdRevisionProperty
                 MsgBox "revision property"
                rev.Accept
            Case wdRevisionParagraphProperty
                 MsgBox "revision para property"
                rev.Accept
            Case wdRevisionParagraphNumber
                 MsgBox "revision para number"
                rev.Accept
            Case wdRevisionDisplayField
                 MsgBox "revision display field"
                rev.Accept
            Case wdRevisionConflict
                MsgBox "revision conflict"
                rev.Accept
            Case wdNoRevision
                MsgBox "no revision"
                rev.Accept
            Case Else
                MsgBox "unknown type"
                doc.Comments.Add rev.Range, "unknown type"
        End Select
    Next
End Sub

1 个答案:

答案 0 :(得分:0)

您可以使用以下代码保留绿色文本颜色:

rev.Range.Font.TextColor = Rgb(44, 98, 52)