提示:其他語言是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! :-)