Tuesday, April 3, 2012

Remove hyperlinks from a word file at a time!


                                                          TRY THIS!!
Sometimes what we hate to do the most becomes a reason for the change in our life. Like any other ordinary day…I thought to continue with the same positivity in my life…but however hard you try, you can never avoid the inevitable. I abhor presenting the copy-paste material for any of my write-ups but the need of the hour did not care of my abhorrence and I had to do it...anyways the positive aspect of this was that I learnt how to remove the hyperlinks at a time from the whole word document! We all refer Wikipedia frequently but if we want to copy-paste the same material..we get a document filled with many hyperlinks. So there is a simple way to remove all these. Follow this:

-First open the document where you want to edit the hyperlinks and press alt+F11 or open the Visual Basic Editor.

-Then click on Insert and then Module. A window will appear before you.


-Then copy-paste the following code on that window and then close the window.
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


-Click on the This Document on the Project window on the left of the Visual Editor.
-Close the Visual Editor and go to the View menu in the MS Word 2007.
-Click on Macros and then select RemoveHyperlinks and click on Run.
Your hyperlinks are removed!!Try it!!
Note: This is for Microsoft word 2007

No comments:

Post a Comment