Macros used with Microsoft Word to add new functionalities to Mendeley's plugin.
Functionalities:
- Hyperlinks for citations pointing to corresponding reference in the bibliography generated by Mendeley's plugin. It supports IEEE and APA CSL citation styles.
- Maintaining Microsoft Word style of the bibliography generated by Mendeley's plugin when refreshing it.
José Luis González García
Removes all hyperlinks of the citations from the document and leaves all fields as originally inserted by Mendeley's plugin. It also removes all bookmarks generated in the bibliography.
Requires: GAUG_getUndoEditButton
Important: It works ONLY with the IEEE and APA CSL citation styles installed with Mendeley. It MAY not work if you make manual modifications to the citation fields, bibliography or both IEEE and APA CSL citation styles.
NOTE: Executing this function may take several minutes; use it with caution. Mendeley is slow when undoing changes to citation fields. It is also called when creating hyperlinks for IEEE and APA citation styles.
Creates the bookmarks in the bibliography as well as the hyperlinks for the citations in the whole document.
Requires: GAUG_removeHyperlinksForCitations
Important: It works ONLY with the APA CSL citation style installed with Mendeley. It MAY not work if you make manual modifications to the citation fields, bibliography or APA CSL citation style.
Creates the bookmarks in the bibliography as well as the hyperlinks for the citations in the whole document.
Requires: GAUG_removeHyperlinksForCitations
Important: It works ONLY with the IEEE CSL citation style installed with Mendeley. It MAY not work if you make manual modifications to the citation fields, bibliography or IEEE CSL citation style.
This is a copy of the original macro installed with Mendeley located in Mendeley-1.16.1.dotm (file name depends on the version of Mendeley), but I could not call it from my own macros.
This is a copy of the original macro installed with Mendeley located in Mendeley-1.16.1.dotm (file name depends on the version of Mendeley). It has been modified in order to keep the Microsoft Word style of the bibliography generated by Mendeley's plugin when refreshing it. Have a look at the three lines with the comment 'MabEntwickeltSich
, you need to add them to the macro of your installation of Mendeley. Follow the installation instructions below.
But remember, this will only work if you used a Microsoft Word style for the bibliography. You can use a build-in style or create your own. If you made manual modifications to the format (font and paragraph) directly to the bibliography and then refresh it, it will go back to the original Microsoft Word style settings.
Important: This macro will NOT work out if its context. This is just to show what modifications have to be made to the original macro installed by Mendeley's plugin.
Copy the code to your Microsoft Word macros to install any of the GWDG_*
macros.
To install refreshDocument
macro you need to modify the original macro by inserting the three extra lines with the comment 'MabEntwickeltSich
:
What you need is to open the file Mendeley-1.16.1.dotm located in C:\Program Files\Mendeley Desktop\wordPlugin (check your own installation, your version of Mendeley may be different) and modify the macro:
Function refreshDocument(Optional openingDocument As Boolean = False) As Boolean
The macro is located in the module MendeleyLib. For this, you may have to enable macros for the document when you open it. You may also need to enable the “Developer” tab in Microsoft Word. Once you finish the modifications, save the changes and close Microsoft Word. Open Mendeley Desktop, uninstall the Microsoft Word plugin and reinstall it again for the changes to take effect.
Execute the desired macro. See also Extending/modifying the code.
My recommendation for a typical usage is to keep your document free of any manual modification to the bibliography or to the citations inserted by Mendeley, but you can merge the citations with the standard way provided by Mendeley: [1][2][3][4] becomes [1]-[4]. This also applies for the APA CSL citation style.
Keep also your document without the bookmarks and hyperlinks generated by these macros while editing. Generate them ONLY when you want to create the PDF file or when you are done with the edition. If you will edit the document again, remove all bookmarks and hyperlinks (generated by these macros) to prevent any conflict with Mendeley's plugin as the citation numbers (in IEEE) or text (in APA) may change.
It is important to note that GAUG_removeHyperlinksForCitations
is very slow. It uses Mendeley's code to restore the original citation fields and bibliography. It is also called from GAUG_createHyperlinksForCitationsAPA
and GAUG_createHyperlinksForCitationsIEEE
to have a clean environment before creating the bookmarks and hyperlinks.
In this moment the code is adapted to my own needs and to the structure of my document. Nevertheless, changing the code to fit other requirements is straight forward when you stick to the IEEE or APA CSL citation styles. Much more effort may be required to support a different CLS citation style; and I can confirm that a lot of effort was done to include APA.
My document is divided in sections (Microsoft Word sections) for the chapters and other parts that are included. The bibliography is located in a section with the title “Bibliography” and style "Titre de dernière section” (custom Microsoft Word style for the title). The macros (to remove or create the hyperlinks) will try to find the bibliography in a section with this description. I did it this way to increase speed in long documents. If you want to remove this restriction and locate the bibliography in any section, simply replace the lines of code If blnFound Then
with If blnFound Or True Then
to force the macro to check every section for the bibliography. You may also need to change the name of the style “Titre de dernière section” in the macros or add it to Microsoft Word, otherwise it will produce an error.
Comments and suggestions are welcome.