Revisions by "Unknown" about "Field Code Changed" in Word

While editing a Word document with Zotero, sometimes embedded field code is automatically modified by Zotero and it leaves lots of revisions by "Unknown" with a sign of "Field Code Changed" during Tracking Changes. They are a bit annoying, so I tried to accept them automatically with VBA or AppleScript. It turned out that Revisions object do not include those changes made by Zotero under the name of "Unknown".

Is there a way to get rid of them easily? If yes, can it be implemented as part of Microsoft Word Add-in?
  • I found a possible solution here. Haven't tested yet.

    Sub AcceptTrackedFields()
    Application.ScreenUpdating = False
    'This sub accepts any tracked changes affecting fields
    Dim Story As Range, oFld As Field, oRev As Revision, Rng As Range
    With ActiveDocument
    ' Loop through all range objects and accept tracked changes on fields
    For Each Story In .StoryRanges
    For Each oRev In Story.Revisions
    For Each oFld In oRev.Range.Fields
    oFld.ShowCodes = True
    Set Rng = oFld.Code
    With Rng
    .MoveEndUntil cset:=Chr(21), Count:=wdForward
    .MoveEndUntil cset:=Chr(19), Count:=wdBackward
    .End = .End + 1
    .Start = .Start - 1
    oFld.ShowCodes = False
    .Revisions.AcceptAll
    End With
    Next
    Next
    Next
    End With
    Set Rng = Nothing
    Application.ScreenUpdating = True
    End Sub


Sign In or Register to comment.