跳到主要内容

如何选择和复制Word文档中的所有超链接?

在某些情况下,您有一个包含多个超链接的长文档,您只需要一次从该文档中复制所有超链接,然后将它们粘贴到另一个文档中。 有什么方法可以快速地一次复制所有这些,而不是一个一个地复制吗?

使用VBA复制所有超链接

使用VBA提取所有超链接地址

使用 Kutools for Word 将所有超链接或仅地址复制到剪贴板好主意3


箭头蓝色右气泡 使用VBA复制所有超链接

1.打开要复制超链接的Word文档,然后按 Alt + F11键 打开 Microsoft基于Visual的应用程序窗口.

2。 点击 插页 > 模块,然后将以下VBA复制到窗口中。

VBA:复制所有超链接

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。 点击 运行 按钮以运行VBA代码。 然后将所有超链接复制到新文档。 您可以稍后保存新文档。 您可以看到如下结果。

请注意: 仅当所有超链接都用单词链接时,此VBA才能运行,如果有带有超链接的图片,则此VBA代码无法使用。


箭头蓝色右气泡 提取所有超链接地址到VBA

1.打开要提取超链接的Word文档,然后按 Alt + F11键 打开 Microsoft基于Visual的应用程序窗口.

2。 点击 插页 > 模块,然后将以下VBA复制到窗口中。

VBA:提取所有超链接地址

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。 点击 运行 按钮以运行VBA代码。 然后,所有超链接地址都提取到一个新文档中,以后可以保存。

请注意: 提取的超链接地址不是按原始顺序。


箭头蓝色右气泡 使用 Kutools for Word 将所有超链接或仅地址复制到剪贴板

如果您想轻松快速地将所有超链接或仅地址从Word文档复制到剪贴板,则 复制超链接 实用程序 Kutools for Word 可以帮你这个忙。

Kutools for Word, 与超过  方便的功能,使您的工作更加轻松。 

安装后 Kutools for Word,请执行以下操作:(立即免费下载 Kutools for Word!)

1。 点击 Kutools 加 > 复制超链接.
doc复制超链接1

2.在弹出的对话框中,根据需要选择一个选项。
doc复制超链接2

现在,选择一个要放置超链接的位置,按 按Ctrl + V 粘贴它们。

复制和粘贴超链接
doc复制超链接3
复制并粘贴超链接地址
doc复制超链接4

分页浏览和编辑多个Word文档/ Excel工作簿,如Firefox,Chrome,Internet Explore 10!

您可能熟悉在 Firefox/Chrome/IE 中查看多个网页,并通过单击相应的选项卡轻松在它们之间切换。在这里,Office Tab支持类似的处理,它允许您在一个Word窗口或Excel窗口中浏览多个Word文档或Excel工作簿,并通过单击它们的选项卡轻松地在它们之间进行切换。
点击免费试用Office Tab!

使用Firefox在一个窗口中浏览多个Word文档

相关文章:

最佳办公生产力工具

Kutools for Word - 通过 Over 提升您的文字体验 100 显着特点!

🤖 Kutools 人工智能助手:用人工智能改变你的写作 - 生成内容  /  重写文本  /  总结文件  /  查询资料 基于文档,全部在Word中

📘 文档掌握: 分页  /  合并文件  /  以各种格式导出选择(PDF/TXT/DOC/HTML...)  /  批量转换为PDF  /  将页面导出为图像  /  一次打印多个文件...

内容编辑: 批量查找和替换 跨多个文件  /  调整所有图片的大小  /  转置表行和列  /  将表格转换为文字...

🧹 轻松清洁: 移开 多余的空间  /  分节符  /  所有标题  /  文本框  /  超链接  / 如需更多拆卸工具,请前往我们的 删除组...

创意插入: 插 千位分隔符  /  复选框  /  单选按钮  /  扫码支付  /  条码  /  对角线表  /  公式标题  /  图片说明  /  表标题  /  多张图片  / 发现更多 插入组...

🔍 精准选择:精确定位 特定页面  /    /  形状  /  标题段落  / 增强导航功能 更多 选择功能...

星级增强: 快速导航至任何位置  /  自动插入重复文本  /  在文档窗口之间无缝切换  /  11 转换工具...

👉 想尝试这些功能吗? Kutools for Word 提供了 60-day免费试用,没有任何限制! 🚀
 
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