Many a times after copying content from webpages to Microsoft Word i end up having a lot of hyperlinks. To remove the hyperlinks, manually right clicking each link and removing the link is tedious, hence i looked for a workaround to disable all links on a word document and i found this code that would help in removing all hyperlinks.
How To:
After creating the entire document go to the Visual Basic Editor in MS Word.
- Alt + F11 (opens VB Editor)
In the editor create a Macro.
- Insert- > Module
Copy the following Code.
Sub RemoveHyperlinks() Dim varField As Field For Each varField In ActiveDocument.Fields If varField.Type = wdFieldHyperlink Then varField.Unlink End If Next Set varField = Nothing End Sub
Return to MS Word
- File -> Close
This will add a Macro “RemoveAllHyperlinks”. Run the Macro to remove all the hyperlinks in the current word document
- Tools -> Macro -> Run “RemoveAllHyperlinks”
Comments»
No comments yet — be the first.