Skip to content

Instantly share code, notes, and snippets.

@d1manson
Last active January 17, 2016 12:32
Show Gist options
  • Save d1manson/228cba8c9ca44c9ac7bc to your computer and use it in GitHub Desktop.
Save d1manson/228cba8c9ca44c9ac7bc to your computer and use it in GitHub Desktop.
set color of zotero references in MSWord using VBA
Sub FormatZoteroRefs()
Set objUndo = Application.UndoRecord
objUndo.StartCustomRecord ("Format Zotero refs")
For Each myStoryRange In ActiveDocument.StoryRanges
For ii = 1 To myStoryRange.Fields.Count
If InStr(1, LTrim(myStoryRange.Fields(ii)), "ADDIN ZOTERO_ITEM CSL_CITATION") = 1 Then
Set rng = myStoryRange.Fields(ii).Result
rng.Font.ColorIndex = 9 ' this seems to be dark blue
End If
Next ii
Next myStoryRange
objUndo.EndCustomRecord
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment