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.


Contact Me With Your Litigation Support Questions:

seankevinoshea@hotmail.com

  • Twitter Long Shadow

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