Note: The other languages of the website are Google-translated. Back to English
登入  \/ 
x
or
x
註冊  \/ 
x

or

如何從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, 與以上 100 方便的功能,使您的工作更加輕鬆。 

安裝後 Kutools for Word,請執行以下操作:(現在免費下載Kutools for Word!)

1。 點擊 Kutools Plus > 複製超鏈接.
doc複製超鏈接1

2.在彈出的對話框中,根據需要選擇一個選項。
doc複製超鏈接2

現在,選擇一個要放置超鏈接的位置,按 按Ctrl + V 粘貼它們。

複製和粘貼超鏈接
doc複製超鏈接3
複製並粘貼超鏈接地址
doc複製超鏈接4

分頁瀏覽和編輯多個Word文檔/ Excel工作簿,如Firefox,Chrome,Internet Explore 10!

您可能很熟悉在Firefox / Chrome / IE中查看多個網頁,並通過輕鬆單擊相應的選項卡在它們之間進行切換。 在這裡,Office選項卡支持類似的處理,使您可以在一個Word窗口或Excel窗口中瀏覽多個Word文檔或Excel工作簿,並通過單擊它們的選項卡輕鬆地在它們之間進行切換。
單擊免費試用Office選項卡!

使用Firefox在一個窗口中瀏覽多個Word文檔

相關文章:


推薦的Word生產力工具

 

Kutools For Word - 100 多個 Word 高級功能,節省 50% 的時間

  • 複雜和重複的操作可以在幾秒鐘內完成一次處理。
  • 跨文件夾一次將多個圖像插入Word文檔。
  • 將文件夾中的多個Word文件合併並合併為所需順序。
  • 根據標題,分節符或其他條件將當前文檔拆分為單獨的文檔。
  • 在Doc和Docx之間,Docx和PDF之間轉換文件,用於常見轉換和選擇的工具集合等...
Say something here...
symbols left.
You are guest
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.
    Gon · 4 months ago
    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!!!

  • To post as a guest, your comment is unpublished.
    Fabian · 3 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 · 4 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 · 4 years ago
    [b]Height of Legendary, thanks a million[/b]
  • To post as a guest, your comment is unpublished.
    Shadab · 5 years ago
    Can I get the same script to run in outlook?
  • To post as a guest, your comment is unpublished.
    Tony Macelli · 5 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. · 5 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 · 4 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 · 5 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 · 5 years ago
    Thank you. Just what I needed to parse a document.
  • To post as a guest, your comment is unpublished.
    Maria · 6 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 · 6 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 · 7 years ago
    wow, its great. Thank you so much
  • To post as a guest, your comment is unpublished.
    Richie · 7 years ago
    Omg this is legendary stuff. So helpful. Thanks a lot! :-)