Skip to main content
 

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

Author: Sun Last Modified: 2024-08-01

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

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.

Document with text with hyperlinks
Arrow
New document with only text with hyperlinks

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


Extract all hyperlink addresses with 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 hyperlink 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.

Document with text with hyperlinks
Arrow
New document with only hyperlink addresses

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


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, equipped with AI 🤖, offers over 100 handy features to simplify your tasks.

After installing Kutools for Word, please do as below:

1. Click Kutools Plus > Copy Hyperlink.
Copy Hyperlink button on the Kutools tab on the ribbon

2. In the popping Copy all hyperlinks to clipboard dialog, choose one option as you need.
Copy all hyperlinks to clipboard dialog box

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

Copy and paste hyperlinks
Text with hyperlinks pasted
Copy and paste hyperlink addresses
Hyperlinks addresses pasted

Demo: Copy All Hyperlinks in a Word Document

 

Discover the Kutools / Kutools Plus tab in this video from Kutools for Word. Enjoy 100+ features and permanently free AI utilities. Download now!


Tabbed Browsing & Editing for Multiple Word Documents/Excel Workbooks, Just Like in Chrome and Edge!

Just like browsing multiple webpages in Chrome, Safari and Edge, Office Tab lets you open and manage multiple Word documents or Excel workbooks in one Word window or Excel window. Switching between documents or workbooks is now simple with a click on their tabs!

Try Office Tab for free now!


Related Articles:

Best Office Productivity Tools

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

🤖 Kutools AI Features: Generate Content / Rewrite Text / Document Q&A / Get Quick Answers / Translate documents / Polish Document (Preserve Format)...

📘 Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...

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 / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...

Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / 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 to Any Location / Auto-Insert Repetitive Text / Toggle Between Document Windows / 11 Conversion Tools...

Kutools and Kutools Plus tabs on the Word Ribbon
👉 Want to try these features? Download Kutools for Word now! 🚀
 

Best Office Productivity Tools

Kutools for Word - 100+ Tools for Word