Recently I have been creating a series of “cheat sheets” on various topics related to blogging and social media using Microsoft Word 2007. These documents are essentially an annotated list of websites related to a particular topic, which I intend to provide to my clients as an aid to their own education and research.
Having long been a WordPerfect user, I was pretty happy with how these documents were looking and how easy it was to create the hyperlinks for them. But suddenly I realized that if I wanted to print one out and hand it to someone, they would have no way of knowing where the hyperlink was pointing to. The url for each link wasn’t visible.
Surely, I thought, I was not the first person to run into this problem. Surely there is an option on some menu that will enable me to display the urls when printing. But I searched the help file to no avail. I checked out three different books on the new version of Word out of the library. Nothing.
You might think it would be easier to copy and paste each url into the document in the appropriate place than to spend time researching a software based solution. But I had already created nine of these documents, and many had over two dozen links in them. That was too much copying-and-pasting for someone who has repetitive strain issues. It was worth it to me to keep hunting for a solution that would not bring on a bout of “tennis” elbow.
I finally got help at a Google Group. Yves, from Belgium, provided me with a macro that gets the job done:
Public Function ConvertHyperlinks()
Dim fld As Field
For Each fld In ActiveDocument.Fields
If fld.Type = wdFieldHyperlink Then
fld.Select
Selection.InsertAfter (" (" + Replace(Split(fld.Code.Text, " ")(1), Chr(34), "") + ")")
End If
Next
End Function
No, I don’t know what it all means. I had a family member who is familiar with Visual Basic for Applications (VBA) look it over to make sure it wasn’t going to do something harmful before I tried it on one of my documents. To do that, I had to teach myself how to use the macro editor, but the library books helped with that.
This is just the latest example of the help I have gotten from total strangers who shared freely of their knowledge and time. I hope someone else faced with the same problem finds this helpful.




{ 5 comments… read them below or add one }
that is really amazing! I’ve been looking for something writing the url just behind the text, but here it just sais ” (HYPERLINK)”
did you chane anything on the macro script?
I didn’t change anything in the macro script, Conrad. I’m sorry; I don’t understand what your problem is.
I see.. well the problem is following:
I have a text and a link like an <a> tag in html within my word document. But when applying this macro (using the “create a new macro” command on developer-tab, inserting the script above and pressing play) it just writes the word “(HYPERLINK)” behind everyone of my linked-text. I was expecting the url of the text within the brackets after every link.
I think it is because you and I were starting from different places. In my original document, the text was already a hyperlink. In other words, you couldn’t see the anchor tag, the text was “clickable.” And what the macro does is make it so you can see the url, because when it’s printed on paper you can’t click on the links. If you want help modifying this macro you should contact Yves, because I don’t know how to change it.
It’s the same in my text.. blue underlined clickable links.. weird.. I will contact Yves and let you know if I have the solution :)
thanks for the advice