MS-Word Macro to convert Zotero citations into clickable Hyperlinks

No doubts that Zotero is a nice piece of software but last time I used it while writing an international grant proposal (French-German ANR-DFG call) I could not find a simple way to turn Zotero's citations into clickable Hyperlinks (but many post on the forum). As I was in a hurry I had to do it manually… Not very convenient and interesting.
It is a real shame that Zotero do not provide an easy way to generate clickable citations with Hyperlinks that points the DOI address of the cited work (long live LaTex!). Hyperlinks are the root of internet and I cannot understand why such basic features are still lacking in all days softwares in this year 2019...
In order to circumvent this missing feature I wrote a MS-Word macro that operate together with modified Zotero style.

Step1:
In brief, you need to modify your preferred Zotero style in order that your citations appear between 2 text marks: "#c1#" and "#c2#" that mark respectively the

start and end of a citation. In addition, you need to modify your preferred Zotero style in order that the corresponding internet address (you want the

Hyperlink to point to) appears right after the citation between 2 text marks: "#a1#" and "#a2#" that mark respectively the start and end of an address.
For example I modified the nice "Minimal style for grant proposals" authored by Anton Crombach to support these 2 modifications:
- on line 78 I added a prefix and suffix for the bibliography layout group :
- after the bibliography layout group I added a text variable that will display the DOI between the 2 text marks discussed before:

Step2:
Use Zotero as usual to add citation to your MS-Word document. Again, as usual once at the end of your writing add the bibliography and use your preferred

Zotero style that you modified in step1 to have text marks appearing in the bibliography. In principle your bibliography should look like this:
#c1#citation1#c2##a1#address1#a2#
#c1#citation2#c2##a1#address2#a2#


Step3:
Unlink Citations. As usual you may want to save your work with a different filename before this step as it cannot be reversed!

Step4:
Run the following macro that will automatically recognize the citation fields and address fields and generate accordingly the hyperlinks (and remove the text marks).

Here is the link to download a 7zip archive that contain the files:
- Readme.txt : a txt file that contains the instructions.
-ZoteroToHL_macro.txt: a txt file that contain the macro for MS-Word.
-minimal-grant-proposals-for-ZoteroToHL.csl : the minimal-grant-proposals Zotero style modified to work with the MS-Word macro.
-ZoteroToHL_testfile.docx : a MS-Word file that I used to test the macro.

The link:
https://seafile.unistra.fr/f/307e02532d88453aaca2/?dl=1

The password: ZoteroToHL
  • This is great! thank you so much! I was in your same position of reading many post but not finding simple solutions.

    I think it would be awesome if this macro can also turn in-text-citations into clickable hyperlinks to the DOI of the item in question.

    I don't know much about modifying citation styles, do you know know how could it be done to achieve that? Preferably on numerical citation styles.

    Thank you once more!



  • That's a great solution, thanks a lot!
    Still it is weird why such a basic feature is still not implemented in Zotero.
  • thank you for sharing this valuable information. Do you have any video where you have applied the above because I am not able to follow on the steps. thank you
  • This is a great solution but I have a problem when citing a document with both URL and DOI. In this case, both URL and DOI are in the citation and it seems that the macro does not like it... For instance

    [#c1#1#c2#]#a1#http://www.sciencedirect.com/science/article/pii/S016609340900442X#a2##a1#https://doi.org/10.1016/j.jviromet.2009.10.003#a2#

    It is perhaps related to a new version of Zotero because I am using ZotoroToHtml for a few months and I did not noticed this problen before. It looks like is not working.
    Any idea ?
  • That is a very useful solution, thanks @fredxyz! Do you think a similar macro could be a solution to LibreOffice as well?
  • Please use the last post in the list for the macro. I wrote 2 entry points:
    Sub linkNumberedReferences for numbered references
    Sub linkAuthorDateReferences for author-date references
    The latter currently goes to the first matching references where the bibliography contains more than one citation starting with the same name.
Sign In or Register to comment.