Wednesday, September 5, 2007

How to Unlink Every Hyperlink in a Microsoft Word Document ?

Unlinking a single hyperlink is as easy as select it, then right-clicking and choosing Remove Hyperlink from the shortcut menu. But what about unlinking all hyperlinks? Word offers no built-in way to unlink every hyperlink in a document all at once. However, you can use a macro to get the job done. Running the following macro achieves the same result as selecting each hyperlink and choosing Remove Hyperlink from the shortcut menu.

I had to come up with this for a document that had something like 100+ Hyperlinks.

  • In Word, click to Tools > Macro > Visual Basic Editor (or press F11)
  • Right-click the Normal icon to make changes to the global template, then select Insert > Module
  • Paste the code below into the text box. Click File > Save Normal. Alternately, you can save this macro in a template of your choice

Sub RemoveAllHyperlinks( )
Dim i As Integer
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
Next i
End Sub

Run this macro in Word from the Tools > Macro > Macros dialog.

This just works wonders when in need.

1 comment: