YOURS TRULEIGH EDITING
  • Home
  • Services
  • Portfolio
  • Testimonials
  • Contact
  • Blog
​Sub DetectAndColourReferenceManagers()

    Dim fld As Field
    Dim fldText As String

    Dim endnoteCount As Long
    Dim zoteroCount As Long
    Dim mendeleyCount As Long
    Dim unknownCount As Long

    Application.ScreenUpdating = False

    For Each fld In ActiveDocument.Fields

        fldText = fld.Code.Text

        ' --- EndNote ---
        If InStr(1, fldText, "EN.Cite", vbTextCompare) > 0 Or _
           InStr(1, fldText, "EndNote", vbTextCompare) > 0 Then

            endnoteCount = endnoteCount + 1
            fld.result.Font.Color = wdColorBlack

        ' --- Zotero ---
        ElseIf InStr(1, fldText, "ZOTERO", vbTextCompare) > 0 Or _
               InStr(1, fldText, "CSL_CITATION", vbTextCompare) > 0 Then

            zoteroCount = zoteroCount + 1
            fld.result.Font.Color = wdColorRed

        ' --- Mendeley ---
        ElseIf InStr(1, fldText, "Mendeley", vbTextCompare) > 0 Then

            mendeleyCount = mendeleyCount + 1
            fld.result.Font.Color = wdColorBlue

        ' --- Unknown citation field ---
        ElseIf InStr(1, fldText, "ADDIN", vbTextCompare) > 0 Then

            unknownCount = unknownCount + 1
            fld.result.Font.Color = wdColorMagenta

        End If

    Next fld

    Application.ScreenUpdating = True

    MsgBox "Reference manager analysis complete:" & vbCrLf & vbCrLf & _
           "EndNote: " & endnoteCount & vbCrLf & _
           "Zotero: " & zoteroCount & vbCrLf & _
           "Mendeley: " & mendeleyCount & vbCrLf & _
           "Unknown / other: " & unknownCount, _
           vbInformation, "Reference Manager Summary"

End Sub
Dr Andrea Kay
​Medical Editor | ​Yours Truleigh Editing

© COPYRIGHT 2026. ALL RIGHTS RESERVED.
  • Home
  • Services
  • Portfolio
  • Testimonials
  • Contact
  • Blog