UPDATE - How to Automate the Insertion of Hyperlinks in MS Word
top of page

UPDATE - How to Automate the Insertion of Hyperlinks in MS Word


The Tip of the Night for May 26, 2015 discussed how to use a macro to add multiple hyperlinks to documents cited in a Word document. At the end of the Tip I noted:

Note if there are bates numbers containing hyphens, you may wish to find and replace these in Word before you begin. If you don't, the generated hyperlinks will not cover the full length of the cited bates numbers. After the macro is run, you can re-insert the hyphens, and the links will still work.

There is actually a better way of avoiding this problem. You can edit the vba code on the line after the one on which you place the path to the folder containing the documents to be linked. This line:

isHyper = 1

specifies the number of words the link is supposed to cover. If it's set to one, only the word from the right of the tag cited in the concordance file will be covered by the hyperlink. So if you're adding a link to a Bates number that has a space between the letter prefix and the multi-digit number, and the code only reads, 'isHyper = 1', you'll just end up with a link that looks like this:

You can cover each word and space in the link by increasing this number.

The number should reflect the total number of words, spaces, and punctuation marks used in the Bates number or other tag. So increase the number for each word, hyphen, underscore, blank space, period, colon or other symbol used in the tag. When the isHyper number matches the parts of the tag, the full length of the tag will be linked to.

Refer to Tip of the Night for May 26, 2015 for the complete instructions on how to link multiple documents in a Word document automatically.


bottom of page