Removing All Hyperlinks from Word

Started by Habanero Smoker, October 01, 2007, 03:23:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Habanero Smoker

I have a later version of Microsoft Word (2003), which I like, but it doesn't have one feature that the earlier versions had. That was the ability to remove all hyperlinks from a document with a few clicks. That's important when I am copying and pasting information from websites into Word.

The version I have you have to right click each hyperlink, then click remove. This becomes a tedious task. I found a macro on the Microsoft site, but it never ran correctly. The macro would skip every other hyperlink, so I would have to run the command three or more times to remove all hyperlinks in the document. This was an improvement, but I still wanted something that worked better. Then I came across this gem of a macro. It will remove all hyperlinks in the active document in one pass.

Remove HyperlinksOpen any document in Word

Hit [ALT]+[F11] to open the Visual Basic Editor
Go to "Insert" ,
Click "Module" and in the pop-up window paste in the following text:

Sub RemoveHyperlinks()
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldHyperlink Then
oField.Unlink
End If
Next
Set oField = Nothing
End Sub


Then click "File";
Click "Close and return to Microsoft Word "

You can now run the Macro in Word by going to:
Tools > Macro > Macros
Then select "RemoveAllHyperlinks"
Click "Run"

This macro is truely a time saver.



     I
         don't
                   inhale.
  ::)

Gizmo

Habs,
Not sure if this will help you but next time you might want to try using the paste special command and select text instead of just using paste.  That will strip all the formatting.
Click here for our time proven and tested recipes - http://www.susanminor.org/

Habanero Smoker

That's for that tip. At one point I used to copy and paste into notepad, then cut and pasted into Word. This macro works great.



     I
         don't
                   inhale.
  ::)

Gizmo

The paste special as text will be the same as pasting into Notepad.   :)
Click here for our time proven and tested recipes - http://www.susanminor.org/

Habanero Smoker

Yes, I know. That is why I added that to my reply. I prefer the macro. Most of the time I don't want to strip all formatting.



     I
         don't
                   inhale.
  ::)