# Word help! Converting hyperlinks to endnotes?

**URL:** <https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899>\
**Category:** Factual Questions\
**Created:** [January 15, 2014, 7:26pm UTC](https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899 "2014-01-15T19:26:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rhythmdvl](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rhythmdvl](https://boards.straightdope.com/u/Rhythmdvl)\
**Post date:** [January 15, 2014, 7:26pm UTC](https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899/1 "2014-01-15T19:26:00Z")

</div>

I have a 200-page book written in Word 2007. It’s got hyperlinks in it that I need to A) keep in there and B) copy to an endnote. So the [end](http://end.end.end.end.end.end.end.com)[sup]1[/sup] product will[sup]2[/sup] be something like this.

…last page where the endnotes go…

[sup]1[/sup][http://end.end.end.end.end.end.end.com](http://end.end.end.end.end.end.end.com)  
[sup]2[/sup][http://will.will.will.will.will.com](http://will.will.will.will.will.com)  
The hyperlinks are all over the place right now, in both the footnotes and in the text, and there’s no pattern to them at all.

My biggest hope is that there’s a simple macro that I can run once that will scour the document and do it in one fell swoop. I can get as far manually as alt-F9/find ^dhyperlink and then highlighting everything, so I assume (oh no!) that it can be automated to some extent. If not, even a manual click on each hyperlink would do if I’m careful.

I found a few things that got me close, but I can’t manage to get them to work. Any help or direction?

Oh, did I mention that I’m kinda screwed–book is due by five today and I just noticed that little request. Oh, clients. I love you!

Rhythm~

---

<div class="post-metadata">

**Author:** ![TroutMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/troutman/32/6721_2.png) [@TroutMan](https://boards.straightdope.com/u/TroutMan)\
**Post date:** [January 15, 2014, 9:10pm UTC](https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899/2 "2014-01-15T21:10:37Z")

</div>

Here’s a quick macro that I _think_ should work. It doesn’t have any error checking and it will probably add duplicate endnotes if you run it more than once (but you said you needed this fast).

Let me know if something doesn’t work and I can try to help.

```auto

Sub HyperlinkToEndnote()
    Dim hl As Hyperlink
    
    For Each hl In ActiveDocument.Hyperlinks
        hl.Range.Select
        Selection.Endnotes.Add Range:=Selection.Range, Reference:=""
        Selection.TypeText Text:=hl.Address
    Next
End Sub

```

---

<div class="post-metadata">

**Author:** ![Amateur\_Barbarian](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@Amateur\_Barbarian](https://boards.straightdope.com/u/Amateur_Barbarian)\
**Post date:** [January 15, 2014, 9:14pm UTC](https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899/3 "2014-01-15T21:14:57Z")

</div>

I don’t have anything specific to add, but some basic mastery of VBA really pays off if you’re an industrial Word user. Being able to supplement features with compound constructs for tasks like this can be worth its weight in e-gold.

But yes, the right simple macro like a variation of the above should do it for your. May the MSforce be with you…

Clients.\* _sigh_\*

---

<div class="post-metadata">

**Author:** ![TroutMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/troutman/32/6721_2.png) [@TroutMan](https://boards.straightdope.com/u/TroutMan)\
**Post date:** [January 15, 2014, 9:18pm UTC](https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899/4 "2014-01-15T21:18:03Z")

</div>

Just noticed you want normal numbering, not roman. Use this:

```auto

Sub HyperlinkToEndnote()
    Dim hl As Hyperlink
    
    For Each hl In ActiveDocument.Hyperlinks
        hl.Range.Select
        Selection.EndnoteOptions.NumberStyle = wdNoteNumberStyleArabic
        Selection.Endnotes.Add Range:=Selection.Range, Reference:=""
        Selection.TypeText Text:=hl.Address
    Next
End Sub

```

And in case you already ran my first attempt, this macro will delete any endnotes so you can recreate them from scratch. Note that it will delete ALL endnotes, so if you had others you want to keep, this will screw you over.

```auto

Sub DeleteEndnotes()
    Dim endnt As Endnote
    
    For Each endnt In ActiveDocument.Endnotes
        endnt.Delete
    Next
End Sub

```

---

<div class="post-metadata">

**Author:** ![Rhythmdvl](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rhythmdvl](https://boards.straightdope.com/u/Rhythmdvl)\
**Post date:** [January 15, 2014, 11:08pm UTC](https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899/5 "2014-01-15T23:08:14Z")

</div>

AAAAAAnnnnnnnddddddd _THANK YOU!_  
AB’s spot on with learning VBA. I ended up learnign a lot more SQL in the late 90s or so monkeying then applying what I knew to MS Access. Opened a huge amount of doors, and I never was a ‘real’ programmer. Heck, I wasn’t even an unreal programmer, but it did wonders. I’m okay at some basic things in VBA, but really do need to find the time to focus.

Troutman, I can’t thank you enough. Not for this (er, I guess I could), but about a year ago you responded with one of my favourite macros, one that creates a [bookmark](http://boards.straightdope.com/sdmb/showthread.php?t=676307). I ended up combining it with another one I’d been using, so now when I rock the mouswheel to the right it adds a highlight to what I’d selected and splits the screen. I can go gallivanting all through the doc, and if I lose my place I just hold alt and flick to the right again and BOOOOOM! It is so incredibly handy. We’re talking hours (literally hours, too, not just those lame metaphoric ones) of time saved over the year and unknowable amounts of frustration and confusion that never took place. Man, that’s one great macro!

---

<div class="post-metadata">

**Author:** ![TroutMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/troutman/32/6721_2.png) [@TroutMan](https://boards.straightdope.com/u/TroutMan)\
**Post date:** [January 15, 2014, 11:23pm UTC](https://boards.straightdope.com/t/word-help-converting-hyperlinks-to-endnotes/678899/6 "2014-01-15T23:23:28Z")

</div>

Excellent, glad I could help!
