Deleting all hyperlinks from a Microsoft Office document

Tired of get­ting Microsoft Office doc­u­ments (Word, Excel, Pow­er­point) that are chock-full of hyper­links that are bright blue and easy to acci­den­tally click, mak­ing Word goes berserk and open the link?

Tired of get­ting Microsoft Office doc­u­ments (Word, Excel, Pow­er­point) that are chock-full of hyper­links that are bright blue and easy to acci­den­tally click, mak­ing Word goes berserk and open the link?

You can eas­ily remove all those pesky URLs with a sim­ple macro to remove all the hyper­links in a doc­u­ment in one full swoop. With macros avail­able to you in one key­stroke (Alt F8) this is quite a con­ve­nient way of man­ag­ing your logic ACROSS all Office soft­ware — the basic logic remains the same. Let's see some code now:

A. Microsoft Word

  1. From a Word doc­u­ment, press ALT F11 to open the MS Visual Basic.
  2. The Visual Basic inter­face will open up. From the INSERT menu, click on MODULE to add a module.
  3. A new doc­u­ment opens up. In there, paste the fol­low­ing code:
    Sub RemoveHyperLinksGLobally()
    Dim i As Integer
    For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
    Next i
    End Sub
  4. Press CTRL S to save this module.
  5. Now, from the FILE menu, select "CLOSE AND RETURN TO MICROSOFT WORD".
  6. When back into your Word doc­u­ment, now just press ALT F8 to bring up the MACROS selec­tion win­dow (or you can always do TOOLS –> MACRO –> MACROS)

Not to worry, this does not delete the text, it just con­verts the hyper­link fields to plain text. How­ever, if your orig­i­nal hyper­link had some for­mat­ting and you don't want to lose that for­mat­ting for the text, but just want to get rid of the under­ly­ing URL, here's some handy code for that too:

Sub RemoveHyperLinksGLoballyButPreserveCharacterStyle()
Dim i As Long, myRange As Range
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
With ActiveDocument.Hyperlinks(i)
Set myRange = .Range
myRange.Style = wdStyleHyperlink
End With
Next i
End Sub
TIP: Microsoft Word also has the "func­tion" to auto-convert any text you type, that looks like a URL, into a hyper­linked URL. If you want to pre­vent this, select TOOLS –> AUTOCORRECT –> AUTOFORMAT AS YOU TYPE, and under "Replace as you type", turn off "Inter­net and net­work paths with hyperlinks".

B. Microsoft Excel

  1. Same process as a MS Word doc­u­ment. From Excel, fire up the VB edi­tor (ALT F11).
  2. The Visual Basic inter­face will open up. From the INSERT menu, click on MODULE to add a module.
  3. A new doc­u­ment opens up. In there, paste the fol­low­ing code:
    Sub RemoveHyperLinksGLobally()
    Dim i As Integer
    For i = ActiveSheet.Hyperlinks.Count To 1 Step -1
    Next i
    End Sub
  4. The only dif­fer­ence from the code for MS Word is high­lighted in green. ActiveSheet, instead of ActiveDocument.
  5. Now, from the FILE menu, select "CLOSE AND RETURN TO MICROSOFT EXCEL".
  6. When back into your Excel doc­u­ment, now just press ALT F8 to bring up the MACROS selec­tion win­dow (or you can always do TOOLS –> MACRO –> MACROS) and select the right macro. Bingo.

How­ever, since we only work with the "ActiveSheet" in the above exam­ple, we remove the hyper­links only from the sin­gle active sheet that is cur­rently on the screen. To remove all the hyper­links from all the work­sheets in an Excel doc­u­ment, this code is handy:

Sub RemoveHyperLinksGLoballyFromAllWorksheets()
Dim i As Integer, wSheet As Worksheet
For Each wSheet In Worksheets
For i = wSheet.Hyperlinks.Count To 1 Step -1
Next i
Next wSheet
End Sub

Hope­full, this gives you ideas on how to author other macros too. With slight tweaks in code, they can be used across all Office soft­ware. Macros are pow­er­ful ways of mak­ing your edit­ing fast. Plus, they are only a key­stroke away (ALT F8) when­ever you need them!

Need a primer to Microsoft Office macros? Read this inter­est­ing 101 piece from PC World first:

  • Ozma

    Thank you, thank you, thank you!

  • Thanh Hai

    Well done. Although some hyper­links are still left unremoved.

  • Dan Kahan

    works great! thanks for mak­ing it pub­lic & free!

  • K.P. Ng

    Didnt work for me but I found a bet­ter way.

    On the Edit menu, click Select All or CTRL+A.
    Then CTRL+SHIFT+F9 on your key­board. Duh!

  • / snip­tools

    Thanks KP, but that one is easy googleable..the macro will work for more than one occa­sions (espe­cially to used in other macros, which I find very useful).

    Why did the macro not work for you though?

  • AuWinger76

    I didn't have any luck with the macro either but the key­board short­cut worked per­fectly for me too! I'm not real famil­iar with cre­at­ing macros so the errors could be mine! At any rate I'm thrilled to not have to do each hyper­link sep­a­rately!! I couldn't even do the 'record macro' func­tion and use the key­board short­cuts men­tioned to set up the macro…! At any rate, thanks to all 'cause I'm at least closer than I was!!

  • Rashmi Patel

    KP That was great!!!!!!!!!!!!!!!!!!…
    The macro didnt work for me too

  • / snip­tools

    Hi Rashmi,

    The method described above works for ALL MS Word instal­la­tions I have tried it on — and this includes Office 97 through XP, En/Cn/Jp/Es/Kr ver­sions. Let me know what error(s) you get, should be a cinch to get it sorted out.

    Just so you know:

    (1) If you are such a freak for key­board short­cuts, macros are just one key­stroke away — ALT F8. Most of my func­tions are in that one key­stroke, instead of remem­ber­ing CTRL SHIFT F9 for this, CTRL SHIFT SOMETHING ELSE for that etc etc.

    (2) Macros are faster than "Select All" (Ctrl A) func­tion­al­ity. If you know the first thing about how Office works, you'll know that the lat­ter takes a lot of RAM, espe­cially on large doc­u­ments. On a 2 – 3 page Word doc­u­ment, it doesn't mat­ter what you use.

    (3) Thirdly, and more impor­tantly, as you will see when I modify/add to this arti­cle above, the macro is very use­ful for tech-savvy folk because the same logic can be used across all Office tools. Try CTRL+SHIFT+F9 in Excel and we'll talk.


  • Seth!

    Shashank, this is very cool but can you post one that removes all hyper­links glob­ally from all work­sheets (in Excel) AND leaves other text for­mat­ting alone? You did that for the Word macro and I tried to mod­ify your Excel macro but was unsuc­cess­ful. Thanks!!

  • Srid­har Vemuru

    Good Work Shanx. It worked great for me.



  • Colleen

    You can do this in Excel: With the excel ssheet open, press ALT 11. select Mod­ule under the Inser menu.

    Type this into the new module:

    Sub Remove­Hy­per­links()

    'Remove all hyper­links from the active sheet

    End Sub

    Then,select "Close and REturn to Microsoft Excel"

    then run the macro called "Remove­Hy­per­links" in your excel ssheet…

  • / snip­tools

    Hi Colleen, this is the code I had before edit­ing this entry. But that ver­sion did not always work for every­one, a bug in MS Office I guess. It's use­ful to know any­way, thanks.

  • hbchrist

    Hate to be a Johnny Come Lately, but I just found and used this. Very nice, and thanks!

  • Kiril

    It work per­fect! Thanx!

  • Baby­Bop

    Ter­rific macro — it did just what I wanted. Thanks!

  • a.h.

    did not work!


    Thank you K.P.!

  • / snip­tools

    "a.h.", can you tell me what ver­sion of Word you're using?

  • kate


    Works great in Word, but is there any way to do the same thing in Pow­er­Point (i.e. remove all hyper­links from all slides at once)? The Word macro doesn't do any­thing in PP.

    kate austin

  • kate

    P.S. Re Pow­er­Point– I tried sub­sti­tut­ing "Pre­sen­ta­tion" for "Doc­u­ment" in the macro, but still no go.

    Thanks again,

  • SAM


  • Opo


  • Kev

    Use­ful code. Thanks.

  • D. Raghu­nad­harao

    Excel­lent macro for word doc­u­ment: I fol­lowed the fol­low­ing:
    Opened the doc­u­ment
    Pressed alt F8
    Pressed cre­ate but­ton
    pasted the fol­low­ing:
    Sub Remove­Hy­per­Links­GLob­ally­But­P­re­serveChar­ac­ter­Style()
    Dim i As Long, myRange As Range
    For i = ActiveDocument.Hyperlinks.Count To 1 Step –1
    With ActiveDocument.Hyperlinks(i)
    Set myRange = .Range
    myRange.Style = wdStyle­Hy­per­link
    End With
    Next i
    End Sub
    returned to main doc­u­ment
    tool … macros
    run macro cre­ated
    viola! all hyper­links removed!

  • San­tosh

    Hi Guys,

    I wanna to add the hyper­links in my MS Word doc­u­ment auto­mat­i­cally. I tried to make it on from auto­cor­rect option. I also unin­stalled the MSof­fice and rein­stalled. But still the prob­lem is there. So can any­body sug­gest me solu­tion for how to insert hyper­links auto­mat­i­cally.

  • appre­cia­tive one

    bad ass this macro is– turned my pain into cyn­i­cal plea­sure– go to hell hyperlinks!

  • DD

    The macro worked per­fectly for me.

    A very large THANK YOU!

  • Andrew Tim­leck

    Thanks, Works in Mac for Office (v 2004). Slight alter­ations — when return­ing to the word doc from the macro you'll find the quit from macro under the "Word" menu, not file. Worked great, saved me tons of time.

  • veiky

    Your code is per­fct but it does not remove all hyper­links from a work­sheet.
    Sup­pose work­sheet has a orga­ni­za­tion chart with a hyper­link then it dosn't removes it…
    I have tried fol­low­ing thing but not remov­ing from orga­ni­za­tion chart.…

    Dim objex­cel As Excel.Application
    Dim obj­work­sheet As Excel.Worksheet
    Dim obj­work­book As Excel.Workbooks
    Dim hlink As Excel.Hyperlinks

    Pri­vate Sub cmddelete_Click()
    Set objex­cel = CreateObject("Excel.Application")
    objexcel.Workbooks.Open ("c:\test hyper.xls")
    objexcel.WindowState = xlMin­i­mized
    objexcel.WindowState = xlMaximized

    Dim Shp As Excel.ShapeRange
    Dim IShp As Excel.Shape
    Dim i As Inte­ger
    Dim j As Inte­ger
    On Error GoTo ResNextShp

    For j = 1 To objexcel.ActiveSheet.Shapes.Count

    Set Shp = Selection.ShapeRange
    If Shp.HasDiagramNode = msoTrue Then
    For i = 1 To Shp.DiagramNode.Diagram.Nodes.Count
    Set IShp = Shp.DiagramNode.Diagram.Nodes(i).Shape
    If IShp.Hyperlink.Address > "" Then
    End If
    Next i
    End If
    Set IShp = objexcel.ActiveSheet.Shapes(j)
    If IShp.Hyperlink.Address > "" Then
    End If
    Next j
    i = 0

    For i = objexcel.ActiveSheet.Hyperlinks.Count To 1 Step –1
    Next i

    Exit Sub

    Resume Next

    End Sub

  • Dan

    Please some­one enlighten me. I have a doc­u­ment where I actu­ally want to delete any text which is a hyper­link. ie. take all the links out of document

    Thanks in advance

  • echo

    Great tool — but in my doc­u­ments I have a table of con­tents (from Insert>Reference>Index and Tables) which hyper­links within the doc­u­ment, and for some rea­son, when I run the macro, the hyper­links in the table of con­tents are removed, but the text is for­mat­ted as hyper­linked (blue and under­lined) when they weren't before the macro was run. I'd like the table of con­tents to remain as for­mat­ted before — any way to to this? Thanks.

  • Colin

    I need the oppo­site of this. I have hun­dreds of Pic­tures (pic­ture 1, pic­ture 2 etc.) with hyper­links asso­ci­ated with them. I want a macro to run through all of the pic­tures and then write the asso­ci­ated hyper­link in text for­mat in a row (a1, a2, a3 etc)

    Ideas please?

  • Joseph

    It work per­fect.….….….…
    Thank you so much.….….….….….….….….….

  • dp

    thanks mate, swell job and a real help.

  • Seri­ous Sam

    The macro was very useful…but there has been a slight glitch.
    By mis­take I have applied the Word doc­u­ment Macro to all tem­plates and doc­u­ments. As a result when­ever I copy and paste any web page into microsoft word, all the hyper­links get con­verted into plain­text. Tell me a way to rem­edy this problem.

    Thanks a lot.

  • Soe­fje

    I have tried this on a large spread­sheet and keep get­ting a run time error.

    Run time error '6':


    When I open the debug­ger it points to the fol­low­ing line:

    For i = ActiveSheet.Hyperlinks.Count To 1 Step –1

    I am not a pro­gram, so I don't know what is going on. I am using Excel 2000.

    Any help would be appreciated.


  • Soe­fje

    Nev­er­mind, fig­ured it out.

    In the sec­ond line, I changed inte­ger to long. Interger go up to 32767.

    It works fine now. Looks like this.

    Sub Remove­Hy­per­Links­GLob­ally()
    Dim i As Long
    For i = ActiveSheet.Hyperlinks.Count To 1 Step –1
    Next i
    End Sub

  • http://Na Sara

    I have been try­ing to write a macro that will cre­ate an hyper­link from one tab to another tab within my excel workbook.

    This macro needs to be flex­i­ble so I'm try­ing to embed a vari­able like "strtab­name & !A1" to set the hyperlink's link to cell A1 of a par­tic­u­lar tab.

    So far I can cre­ate an inac­tive hyper­link. Sug­ges­tions will be most appre­ci­ated, this is dri­ving me crazy and I have yet to find a suit­able exam­ple online or amongst co-workers. Thank you.

  • TBJC

    Thanks! Worked great — saved me hours!!

  • Syed Moham­mad Ali

    Can some­body please tell me how to con­vert text that looks like a URL pro­gram­mat­i­cally to a hyper­link. I know this fea­ture can be incor­po­rated by aut­o­for­mat­ing but I want to do it programmatically.

  • Tom LaRussa


    Your lit­tle bit of code has saved me G*d only knows how many hours of frustration!

    I only wish I'd found your tip sooner, as I've been remov­ing links from Word docs (I use Word 97) man­u­ally for years.



  • Brent Hugh

    I had a sim­i­lar prob­lem, I pasted a page with a bunch of "email this con­tact" links from a web page into Word. Then I wanted to con­vert all the hyper­links Word made into just plain text email addresses rather than a blue link that said "email this contact".

    This script did the trick:

    Sub ChangeEmailAd­dressHy­per­link­To­Plain­Text()
    ' Macro
    ' Macro cre­ated 8÷19÷2006 by Brent Hugh

    Dim i As Inte­ger
    For i = ActiveDocument.Hyperlinks.Count To 1 Step –1
    ActiveDocument.Hyperlinks(i).Range = ActiveDocument.Hyperlinks(i).Address
    Next i

    End Sub

  • charuta kulka­rni

    this is so cool. i work with gigan­tic word docs full with links that i m sup­posed to remove. this is a bless­ing for me.
    thanks a zillion.

  • Jen­nie

    Thanks!!! I was hav­ing a really hard time try­ing to delete the hyper­links from my 30+ page doc­u­ment and found this. After I did the Macro thing, all the hyper­links dis­ap­peared like magic. Thank a mil­lion!!!!!!! You can't believe how grate­ful I am right now. =)

  • Tom

    Ecel­lent! Thanks!

  • gor­don

    Solu­tion for Dan [29]:
    This means find­ing text with dif­fer­ent for­mat (usu­aly Blue + Under­lined), and replac­ing with "noth­ing" for each found item. Here is a sim­ple method:

    Open Find/Replace dia­log box

    Find What: Font: Under­line, Font color: Blue

    will find all Under­line and Blue strings, and

    Replace With: (leave box empty)

    click 'Replace All'

  • Trip­py­tom

    This is how you would do it in Pow­er­Point (works in 2003, not sure of ear­lier versions):

    Sub NoHy­per­links()

    Dim i As Long
    Dim hl As Hyperlink

    For i = 1 To ActivePresentation.Slides.Count
    For Each hl In ActivePresentation.Slides(i).Hyperlinks
    Next hl
    Next i

    End Sub

  • Polly

    I have tried all of the above to get rid of hyper­links from a for­mat­ted inven­tory (mostly color fill, font col­ors &sizes, EXCEL work­sheet I use every­day. I can­not get rid of them. For awhile (about a week) it worked, but today when I opened up the sheet (with macros enabled) it was rid­dled with them.…worse than before. If I run:

    Sub Remove­Hy­per­Links­GLob­al­lyFro­mA­ll­Work­sheets()
    Dim i As Inte­ger, wSheet As Work­sheet
    For Each wSheet In Work­sheets
    For i = wSheet.Hyperlinks.Count To 1 Step –1
    Next i
    Next wSheet
    End Sub

    I get a run time error and Excel auto recov­ers and closes. I have run oth­ers (in addi­tion to the above) that I have found on Google. But to no avail. Where do these d*** things come from. I've never added a hyper­link any­where in this work­sheet, but now every cell across and down for 171 rows has the same one. It's an inven­tory doc­u­ment and even if I CAN get rid of them, I will have to refor­mat 2200+ cells to reflect inven­tory changes. HELP!!!

  • Jes­sica

    thank you this actu­ally worked
    but the prob­lem is that is does get rid of the hyper­links but not the hyper­links of any pictures

  • Stephen Bridge

    Thank you very much! This has been a real help to me.

  • Don

    To rem­pve all hyper­links in word. Ctrl-A then Ctrl-Shift-F9


  • http://[email protected] scan­bix

    Thank you. Great!
    ping back in Lithuan­ian from

  • http://n/a Jason Pointer

    Thanks for this.

    I have been strug­gling with this prob­lem for a cou­ple years because it slows down my com­puter when I load and/or scroll through documents.

    For all of y'all with macs, it works on it too…

  • Paul

    Thank you so much. I've been try­ing to fig­ure this out for *ages*!
    *Very* much appreciated.

  • Angelique

    OMG! I actu­ally did a happy dance. Thank you so much. This was extra­or­di­nar­ily helpful.

  • James

    both worked fine for me 😀 Thanks both of you

  • A.Walker

    Bril­liant, I've never used macro before but the instruc­tions were v. easy to fol­low and it took a sec­ond to work. Thought I'd spend the time I will now be sav­ing to write a thank you!

  • brian

    How do I undo the macro — i got it to work
    but now when ever i paste any­thing into word that has hyper­links it removes them

  • Near­ly­Nor­mal

    Brian, you can undo what you did: go into the Macro win­dow (ALT F8) and remove the hyper­link removal macro. Let me know if it works.

  • pratish

    i have just one word for this Baaaaaaaaaaaaang

  • Renuka

    Won­der­ful, thanks a lot. great help

  • Trevor


    I am using MS Word 2007… I fol­lowed your steps by adding the mod­ule in MS Visual Basic and then applied to doc­u­ment. How­ever, I want to dis­able it as I need to have hyper­links in some of my doc­u­ments. But now when­ever I copy text over that has a hyper­link, it gets rid of the hyper­link and makes it turn into the actual link web address. It is doing that in all of my Word doc­u­ments that I cre­ate now. So basi­cally, how do I go about deleting/disabling this fea­ture permanently?

    Please let me know as soon as possible.


  • Melissa

    I like this macro — but I want to do some­thing fur­ther — I want to copy the URL from the HYPERLINK field, then remove the hyper­link so that I end up with some thing like this:

    Mom's Diner

    I need the URL infor­ma­tion, but I want it dis­played inde­pen­dently of the hyper­linked text.

    Any thoughts? It's tak­ing me a HUGE amount of time to sort this out on my own.

    Thanks in advance!


  • rishard

    this is fan­tas­tic and really easy to use. I am utterly use­less with com­puter stuff, and it worked per­fect the first time.

  • nigazh

    trhanks u vry much.…i got wat i wanted…

  • Spurr

    Thank you for post­ing. It is very useful

  • Tracy in SW WA

    This is just what I've needed for a long time. Copied/pasted pain­lessly to Win 7.

  • Umang

    Thank you for the help. It works won­der­fully. One can­not expect free lessons in VB but could you sug­gest some minor tweaks in the code for addi­tional things which could be done with this code? Thanks again.

  • Jeane

    All my Word doc­u­ments that have email or inter­net addresses sud­denly started dis­play­ing {HYPERLINK "mailto: before the email address, then after the email address there is the end bracket " }" I can remove the hyper­links one-by-one, but all doc­u­ments I open that have email or inter­net addresses still has the prob­lem.. I have unchecked the box for inter­net and net­works paths with hyper­links in Auto­Cor­rect. It didn't help.

    I am run­ning Run­ning Microsoft Office 2003 and Win­dows XP Pro­fes­sional 2002 Ser­vice Pack 3
    Do you think the above will cor­rect the problem?

  • Webau­to­crat

    Thank you very much. It helped me a lot.