Skip to main content

How to select and copy all hyperlinks from a Word document?

In some cases, you have a long document with multiple hyperlinks existing in, and you only need to copy all the hyperlinks at once from this document and then paste them to another one. Is there any way can quickly copy all of them at once instead of copying them one by one?

Copy all hyperlinks with VBA

Extract all hyperlinks addresses with VBA

Copy all hyperlinks or only addresses to clipboard with Kutools for Wordgood idea3


arrow blue right bubble Copy all hyperlinks with VBA

1. Open the Word document which you want to copy the hyperlinks, and press Alt + F11 to open the Microsoft Visual Based Application Window.

2. Click Insert > Module, and copy the following VBA into the Window.

VBA: Copy all hyperlinks

Sub HyperlinksExtract()
'Updateby20140214
    Dim oLink As Hyperlink
    Dim docCurrent As Document 'current document
    Dim docNew As Document 'new document
    Dim rngStory As StoryRanges
    Set docCurrent = ActiveDocument
    Set docNew = Documents.Add
    For Each oLink In docCurrent.Hyperlinks
        oLink.Range.Copy
        docNew.Activate
        Selection.Paste
        Selection.TypeParagraph
    Next
    
    Set docNew = Nothing
    Set docCurrent = Nothing
End Sub

3. Click the Run button to run the VBA code. Then all the hyperlinks are copied to a new document. You can save the new document later. You can see the result as follows.

Note: This VBA only can run when all the hyperlinks are linked with word, if there are pictures with hyperlinks, this VBA code cannot work.


arrow blue right bubble Extract all hyperlinks addressesith VBA

1. Open the Word document which you want to extract the hyperlinks, and press Alt + F11 to open the Microsoft Visual Based Application Window.

2. Click Insert > Module, and copy the following VBA into the Window.

VBA: Extract all hyperlinks addresses

Function GetAllHyperlinks()
'Updateby20140214
    Dim docCurrent As Document
    Dim docNew As Document
    Dim oLink As Hyperlink
    Dim rng As Range
    Application.ScreenUpdating = False
    Set docCurrent = ActiveDocument
    Set docNew = Documents.Add
    For Each oLink In docCurrent.Hyperlinks
        Set rng = docNew.Range
        rng.Collapse
        rng.InsertParagraph
        rng.InsertAfter (oLink.Address)
    Next
    docNew.Activate
    Application.ScreenUpdating = True
    Application.ScreenRefresh
End Function

3. Click the Run button to run the VBA code. Then all the hyperlinks addresses are extracted in a new document, you can save it later.

Note: The extract hyperlinks address are not in the original order.


arrow blue right bubble Copy all hyperlinks or only addresses to clipboard with Kutools for Word

If you want to copy all hyperlinks or only addresses to clipboard from Word document easily and quickly, the Copy Hyperlink utility of Kutools for Word can do you this favor.

Kutools for Word, with more than  handy functions, makes your jobs easier. 

After installing Kutools for Word, please do as below:(Free Download Kutools for Word Now!)

1. Click Kutools Plus > Copy Hyperlink.
doc copy hyperlinks 1

2. In the popping dialog, choose one option as you need.
doc copy hyperlinks 2

Now, select one location you want to place the hyperlinks, press Ctrl + V to paste them.

Copy and paste hyperlinks
doc copy hyperlinks 3
Copy and paste hyperlink address
doc copy hyperlinks 4

Tabbed browsing & editing multiple Word documents/Excel workbooks as Firefox, Chrome, Internet Explore 10!

You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Word documents or Excel workbooks in one Word window or Excel window, and easily switch between them by clicking their tabs.
Click for free trial of Office Tab!

Browse multiple word documents in one window as Firefox

Relative Articles:

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

🤖 Kutools AI Assistant: Transform your writing with AI - Generate Content  /  Rewrite Text  /  Summarize Documents  /  Inquire for Information based on Document, all within Word

📘 Document Mastery: Split Pages  /  Merge Documents  /  Export Selection in Various Formats (PDF/TXT/DOC/HTML...)  /  Batch Convert to PDF  /  Export Pages as Images  /  Print Multiple Files at once...

Contents Editing: Batch Find and Replace across Multiple Files  /  Resize All Pictures  /  Transpose Table Rows and Columns  /  Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces  /  Section Breaks  /  All Headers  /  Text Boxes  /  Hyperlinks  /  For more removing tools, head to our Remove Group...

Creative Inserts: Insert Thousand Separators  /  Check Boxes  /  Radio Buttons  /  QR Code  /  Barcode  /  Diagonal Line Table  /  Equation Caption  /  Image Caption  /  Table Caption  /  Multiple Pictures  /  Discover more in the Insert Group...

🔍 Precision Selections: Pinpoint specific pages  /  tables  /  shapes  /  heading paragraphs  /  Enhance navigation with more Select features...

Star Enhancements: Navigate swiftly to any location  /  auto-insert repetitive text  /  seamlessly toggle between document windows  /  11 Conversion Tools...

👉 Want to try these features? Kutools for Word offers a 60-day free trial, with no limitations! 🚀
Free Download     Read More     Buy Now
 
Comments (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Good information! It assisted me in extracting links from an html file I had opened in Word. Refer to <a href="https://cookieclicker2.io">cookie clicker</a> is idea new.
This comment was minimized by the moderator on the site
How can we export word file hyperlinks and it's Text display to an excel file ? 
This comment was minimized by the moderator on the site
Impresionante! Millón de gracias.Me has acercado a la solución muchísimo pero si fuera posible copiarlos en la fila 1 de un excel ya creado sería impresionante. Es para aplicarles una formula que separa los links del texto.Un saludo y un millón de gracias!!!

This comment was minimized by the moderator on the site
Thank you so much! This was exactly what I was looking for!
This comment was minimized by the moderator on the site
I am amazed. That's gold. You saved me a ton of work.
This comment was minimized by the moderator on the site
Height of Legendary, thanks a million
This comment was minimized by the moderator on the site
Can I get the same script to run in outlook?
This comment was minimized by the moderator on the site
This is great stuff! Many thanks. What changes do I need to make to GetAllHyperlinks() for the following case? -- original document contains both normal text and links -- result wanted: same document but each link is followed by a space and the URL Thanks
This comment was minimized by the moderator on the site
Excellent! It helped me extract some links from an html file that I opened with Word (Excel was discarding some links). Here is the modified code so that a csv file could be built that could be further used. [quote]SubGetAllHyperlinks() ' Updateby20160504 ' https://www.extendoffice.com/documents/word/1411-word-select-copy-all-hyperlinks.html+&cd=1&hl=en&ct=clnk&gl=us<br /> Dim docCurrent As Document Dim docNew As Document Dim oLink As Hyperlink Dim rng As Range Application.ScreenUpdating = False Set docCurrent = ActiveDocument Set docNew = Documents.Add For Each oLink In docCurrent.Hyperlinks Set rng = docNew.Range rng.InsertAfter (oLink.TextToDisplay) rng.InsertAfter (", ") rng.InsertAfter (oLink.Address) rng.InsertAfter (vbCrLf) Next docNew.Activate Application.ScreenUpdating = True Application.ScreenRefresh End Sub[/quote]
This comment was minimized by the moderator on the site
This code works fine to me. The two on examples in the article description don't. Thanks a lot and my best regards.
This comment was minimized by the moderator on the site
Thank you very much for this script. This helped me to extract 5K links. Thank you very much.
This comment was minimized by the moderator on the site
Thank you. Just what I needed to parse a document.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations