List all hyperlinks?



A Word.doc has several hundred hyperlinks embedded in it.

The user needs to edit the paths of all those hyperlinks, ie, maybe he needs
to migrate the document to some other PC or file server location, or needs to
change some of the destinations, and/or just needs to quickly identify
identical hyperlinks that appear in multiple locations throughout the .doc.

Is there a way to list, view and edit just the hyperlinks and their paths,
rather than tediously going from one hyperlink to another and using Word's
Edit Hyperlink dialog on each one?


Hyperlinks are fields. If you toggle field codes (Alt+F9), you can use Find
and Replace to replace a hyperlink address with another throughout the entire

Fields can be in two modes: they can show the result, i.e. the content that
will print, or they can show the code behind. Alt+F9 toggles field codes on
and off.

Lene Fredborg
DocTools - Denmark
Document automation - add-ins, macros and templates for Microsoft Word


First, to list the hyperlinks in the main story, create the following macro:

Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdPageBreak
Selection.Style = ActiveDocument.Styles("Heading 3")
Selection.TypeText Text:="List of hypertext links in this document"

Dim hlHyperlink As Hyperlink

For Each hlHyperlink In ActiveDocument.Hyperlinks
Selection.TypeText Text:=hlHyperlink.Name

Re macros, see:

I have never been able to figure out how to create a macro to change the
path for all documents; I've only been able to change the path with a series
of macros for each named file.

Warning: Do not display field codes and use Find and Replace; this does not


Have a huge job to do identifying hyperlinks in hundreds of documents - took
awhile to find this but it was certainly worth the effort.
Thankyou Aeneas - macro worked a treat.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question