Remove All Hyperlinks in Word or Excel

Contributor Icon Contributed by katy8439 Date Icon April 3, 2006  
Tag Icon Tagged: Microsoft Office

These two nifty macros enable you to delete the embedded hyperlinks that are generated when typing URLS or copying information from the web.


Ever copy and paste something from the Internet and then into Word only to get the hyperlinks embedded? You can removed them easily with the Macros below.

Word

Hit [ALT]+[F11] to open the Visual Basic Editor

Go to “Insert” > “Module” and in the pop-up window copy:

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” > Close and return to Microsoft Word

You can now run the Macro in Word by going to:

Tools > Macro > Macro and then Run “RemoveAllHyperlinks”

Excel:

You can do the same in an Excel Document:

Hit [ALT]+[F11] to open the Visual Basic Editor

Go to “Insert” > “Module” and in the pop-up window copy:

Sub RemoveHyperlinks()
'Remove all hyperlinks from the active sheet
ActiveSheet.Hyperlinks.Delete
End Sub

Then click “File” > Close and return to Microsoft Excel

You can now run the Macro in Excel by going to:

Tools > Macro > Macro and then Run “RemoveAllHyperlinks”, this will delete all URLS on the selected worksheet.

Previous recipe | Next recipe |
 
  • Dehkay
    Very good.
    Have been attempting to find a solution for some time.
    This macro cleared all links in a very large file at the first attempt.
    Dehkay
  • fhff
    Awesome!!!!!!! saved me so much time lol thanks
  • James
    very nice! thanks for the tip!
  • Scott
    THANK YOU! 1 Million ties thank you!!
  • Umer
    Awesome work, after learning such thing, I feel like a geek ;-)
  • Student
    Select the entire block of text, then press Ctrl-Shift-F9. Presto: No more hyperlinks. In their place, plain text.
  • Shivshanker Cheral
    Also by presssing Ctrl + 6 we can do this!
  • Will
    Wow, very helpful! Thank you!
  • gurinder
    thanks ...

    very very nice.. was so easy with your help

    gurinder singh
  • agun
    owo great .... thank u ...
  • Shivshanker Cheral
    you can remove hyperlink using Ctrl+6 also
  • Nishant
    Hey
    I ran the above macro during a term paper that i was working on, in MS Word 2007.
    Works great - removed all the hyperlinks....
    Thanks ALOT!!
  • john
    Very useful to me. Thank you so much :D :D
  • Blandoo
    Somehow this does not work for javascript embedded within a picture (buttons). Please let me know if there is a "Remove all Javascript" macro I can run.

    Thanks
  • Najen
    Hi here is code to remove all shapes which include objects ActiveX controls (Control Toolbox) or a linked or embedded OLE objects,Controls from the Forms toolbar
    ,Controls from the Drawing toolbar,Pictures, chartsactive x,buttons,pcitures,drop down lists etc.It will basically remove all these objectsActiveX controls. even cell comments but not cell comments

    Code:

    Sub Shapes1()
    'Delete all Objects except Comments
    On Error Resume Next
    ActiveSheet.DrawingObjects.Visible = True
    ActiveSheet.DrawingObjects.Delete
    On Error GoTo 0
    End Sub
  • Worked like a charm for removing all hyperlinks - thanks
  • sil
    Many Thanks for this help, Muchly appreciated
  • me
    ok.. it works... thanks a lot.. i've been loocking for this.. just not hard enough until now because i didn't have that much text copied.. it actually took me 2 minutes to find this... and it's great.. and u actually don't need to know anything.. just follow the easy instructions
  • shabi
    it's really very good
  • Dan
    In Office 07 for words. The macro section is under the "view tab" to the far right.
  • orpheus
    Thank you very much. It's very useful.
  • tabi
    This didn't work for me...maybe a problem with Excel 2007? Or my stupidity, it's tough to say.
  • CasuaL
    Great work, thanks a lot :)
  • Bob
    Excellent - saved me having to remove 700+ hyperlinks by hand.
    Super huge thanks
  • Sridhar
    Marvellous
  • Jason
    Damn Nice!
    Thank you so much.
  • sasikanth
    it nice it working thanks
  • prasad
    very very very very very thanks
  • Johnny
    Thank you very much.
    Made my life a whole lot easier. =D
  • Anji
    THANKS that's great! Saved me precious time. Worked on my mac too.
  • k
    gr8! saves me a lot of time.
  • Andy McDandy
    Thanks a lot..great help
  • Prashanth
    just copy to notepad and paste it back!
  • adam
    I have been ALWAYS looking for this.

    Didn't know I'd ever FIND it, just by googling. Congrats. GREAT CODE!
  • ivica
    TNX
  • nox13666
    Thanks, this worked
  • vm0430
    how to enable hyperlink, after removing it using VB..?
  • Kevin
    Thank you for your help. This is a command that Microsoft clearly forgot to add. Great job! Although I have written plenty of macros (mostly on Excel, but a few in Word), I was not excited about adding to my already large set of macros... but I'm glad that I did. It works perfectly!

    Thanks
  • senthilds08
    i need macro programs pls send your macros what u have.
    tks
  • God, thank you! This is so clean and direct, without entering a bunch of dummy data to sidestep the problem. Thank you so much.
  • There's another tip that says to select all text and clear formatting. But this makes it lose formatting.

    I found yet another way, just select some normal text in the paragraph and click the Format Painter. Then select all the text where you want hyperlinks removed. The text retains most of the formatting (except when it disagrees with the original text selected before clicking Format Painter).
  • senthilds08
    yes its also working good
    thanks dear
  • Vanessa
    OMFG thx u! it works! i am soooo hppy! :D
  • rickd24
    Adding another thank you to the list!
  • senthilds08
    Very Very Thanks
  • Jay
    Thank You, this worked like a dream.
  • bninad
    dude whoever you are
    u rock
    this is excellant
  • me
    cool. never used a macro before :)
  • Si
    THANKS! This was really handy when pasting Wikipedia articles into Word
  • Pirnima
    Thank You So much .. my file size has been reduced by half... Thank you really I have been looking for a solution since 3 years!!

    Is there a way where you can can keep the hyperlinks in one column that you want .. and remove it from the rest of the sheet?
  • That's strange. How do hyperlinks make your file two times bigger? Anyway to selectively remove hyperlinks, I posted the following in a previous comment (2 months ago) for Word:

    ----
    There's another tip that says to select all text and clear formatting. But this makes it lose formatting.

    I found yet another way, just select some normal text in the paragraph and click the Format Painter. Then select all the text where you want hyperlinks removed. The text retains most of the formatting (except when it disagrees with the original text selected before clicking Format Painter).
    ----

    As for Excel, you can try the second way there too! Just select a cell with normal text, then click (or double-click if you want to do multiple times) the Format Painter, then select the columns with hyperlink that you want removed. Remember that all the selected columns will have the same formatting as the original cell you selected.

    Well apparently I discovered that in both Word and Excel, it doesn't actually remove the hyperlink but only make the formatting of the link similar to the normal text you selected. This means the links no longer look like links anymore (it looks like normal text now), but when you click on it, it still launches your browser to navigate to the link address.
  • arun_lee
    Thanks for the help. It helped me & saved my time.
  • Very Useful Stuff :-)
  • chhenglongchhen
    i don't know delete hyperlink in Microsoft Office Word 2003
  • amar_yadav
    I just wanted to ad something if one wants to use the same with Office 2007 or later.
    The procedure is just the same but in order to execute it we need to click on office button, then change the Popular Commands Drop Box to Macros.
    Click on the remove.....
    Add>
    Done!
  • Simplifier
    Or...select all the text and press CONTROL+6
  • Tom
    Thanks for the MS word solution. I couldn't figure out how to get rid of those stupid hyperlinks. Very greatful.
  • Tom
    Thanks for the MS word solution. I couldn't figure out how to get rid of those stupid hyperlinks. Very greatful.
  • shanwa
    THANK YOU X 100000000000000000000000000000000000000000000. I had over a week long work load of deleting these and this did it in seconds!!!!!!!!!!
  • Jim
    My only question is, why isn't this option in the program to begin with? Answer: Microsoft.
  • Thanks for the info.
    Saved heaps of time and was so easy to do.
    A+
blog comments powered by Disqus