提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

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

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

使用VBA复制所有超链接

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

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


箭头蓝色右泡 使用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代码就无法工作。


箭头蓝色右泡 提取所有超链接address 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, 与超过 100 方便的功能,使您的工作更轻松。
转到下载
免费试用45天

安装后 Word的Kutools,请按照以下步骤操作:(免费下载Kutools for Word Now!)

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

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

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

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

选项卡式浏览和编辑多个Word文档/ Excel工作簿,如Firefox,Chrome,Internet探索10!

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

在一个窗口中以Firefox浏览多个单词文档

相关文章:



推荐的Word生产力工具

Kutools For Word - 超过100 Word的高级功能,节省您的50%时间

  • 复杂和重复的操作可以在几秒钟内完成一次性处理。
  • 一次将多个图像跨文件夹插入Word文档。
  • 将多个文件夹合并并组合成一个具有所需订单的文件。
  • 根据标题,分节符或其他标准将当前文档拆分为单独的文档。
  • 在Doc和Docx,Docx和PDF之间转换文件,用于常见转换和选择的工具集合等等......
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Fabian · 1 years ago
    Thank you so much! This was exactly what I was looking for!
  • To post as a guest, your comment is unpublished.
    Adrine Bio · 1 years ago
    I am amazed. That's gold. You saved me a ton of work.
  • To post as a guest, your comment is unpublished.
    manny kuyr · 2 years ago
    [b]Height of Legendary, thanks a million[/b]
  • To post as a guest, your comment is unpublished.
    Shadab · 2 years ago
    Can I get the same script to run in outlook?
  • To post as a guest, your comment is unpublished.
    Tony Macelli · 3 years ago
    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
  • To post as a guest, your comment is unpublished.
    Sanjay K. · 3 years ago
    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
    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]
    • To post as a guest, your comment is unpublished.
      Pompeia · 2 years ago
      This code works fine to me. The two on examples in the article description don't. Thanks a lot and my best regards.
    • To post as a guest, your comment is unpublished.
      Rashesh Bosamiya · 3 years ago
      Thank you very much for this script.
      This helped me to extract 5K links.

      Thank you very much.
  • To post as a guest, your comment is unpublished.
    Dean · 3 years ago
    Thank you. Just what I needed to parse a document.
  • To post as a guest, your comment is unpublished.
    Maria · 3 years ago
    Indeed! ONE year later, am having similar issues and totally bawled over by your wonderful help!!
    God Bless YOu!!
  • To post as a guest, your comment is unpublished.
    sid · 4 years ago
    it is prompting " Compile Error: Syntax Error"
    Please help me, I need to do a lot of work using this .Reply asap
  • To post as a guest, your comment is unpublished.
    Mert · 5 years ago
    wow, its great. Thank you so much
  • To post as a guest, your comment is unpublished.
    Richie · 5 years ago
    Omg this is legendary stuff. So helpful. Thanks a lot! :-)