MS Word Macro - Getting a List of Hyperlinks
top of page

MS Word Macro - Getting a List of Hyperlinks


I've used this macro many times for various purposes, and it always works. It will go through a Word document and make a list of all of the hyperlinks that have been added. If you don't have experience with macros, this is all you need to do (assuming you're using MS Word 2010):

1. In Word, press Alt + F11, to open Visual Basic.

2. The Project pane on the upper left, find where the 'Module' folder is, and right click and select 'insert Module'.

3. Copy and paste this macro in the blank window on the right. Thanks to Jay Freedman who posted this macro at http://www.wordbanter.com/showthread.php?t=145056

Sub ListHyperlinks()

Dim srcDoc As Document, destDoc As Document

Dim HL As Hyperlink

Set srcDoc = ActiveDocument

Set destDoc = Documents.Add

For Each HL In srcDoc.Hyperlinks

destDoc.Range.InsertAfter _

HL.TextToDisplay & vbTab & HL.Address & vbCr

Next

destDoc.Range.ConvertToTable

End Sub

4. Go to File . . .Close and Return to Microsoft Word.

5. Go to View . . . Macros . . . View Macros.

6. Select 'ListHyperlinks' and click 'Run'.

7. The macro will generate a new document with a table containing two columns. The column on the left will list the word or phrase that the link was added to. The column on the right will list the full path of the hyperlink.


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page