Gå til hovedindhold

Sådan vælger og kopierer du alle hyperlinks fra en Word dokumentere?

I nogle tilfælde har du et langt dokument med flere hyperlinks, der findes, og du behøver kun at kopiere alle hyperlinks på én gang fra dette dokument og derefter indsætte dem til et andet. Er der nogen måde, der hurtigt kan kopiere dem alle på én gang i stedet for at kopiere dem en efter en?

Kopier alle hyperlinks med VBA

Uddrag alle hyperlinks-adresser med VBA

Kopier alle hyperlinks eller kun adresser til udklipsholder med Kutools for Wordgod idé3


pil blå højre boble Kopier alle hyperlinks med VBA

1. Åbn Word dokument, som du vil kopiere hyperlinkene, og tryk på Alt + F11 at åbne Microsoft Visual Based Application Window.

2. klik indsatte > Moduler, og kopier følgende VBA i vinduet.

VBA: Kopier alle 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. Klik på Kør knappen for at køre VBA-koden. Derefter kopieres alle hyperlinks til et nyt dokument. Du kan gemme det nye dokument senere. Du kan se resultatet som følger.

Bemærk: Denne VBA kan kun køre, når alle hyperlinks er forbundet med word, hvis der er billeder med hyperlinks, kan denne VBA-kode ikke fungere.


pil blå højre boble Uddrag alle hyperlinks adresser med VBA

1. Åbn Word dokument, som du vil udpakke hyperlinkene, og tryk på Alt + F11 at åbne Microsoft Visual Based Application Window.

2. klik indsatte > Moduler, og kopier følgende VBA i vinduet.

VBA: Uddrag alle hyperlinks-adresser

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. Klik på Kør knappen for at køre VBA-koden. Derefter ekstraheres alle hyperlinks-adresser i et nyt dokument, du kan gemme det senere.

Bemærk: Uddrag af hyperlinks-adresse er ikke i den oprindelige rækkefølge.


pil blå højre boble Kopier alle hyperlinks eller kun adresser til udklipsholder med Kutools for Word

Hvis du vil kopiere alle hyperlinks eller kun adresser til udklipsholder fra Word dokumenter nemt og hurtigt Kopier hyperlink nytte af Kutools for Word kan gøre dig denne tjeneste.

Kutools for Word, med mere end  praktiske funktioner, der gør dine job lettere. 

Efter installation Kutools for Wordskal du gøre som nedenfor:(Gratis download Kutools for Word Nu!)

1. klik Kutools Plus > Kopier hyperlink.
doc-kopi-hyperlinks 1

2. I poppedialogen skal du vælge en mulighed, som du har brug for.
doc-kopi-hyperlinks 2

Vælg nu et sted, du vil placere hyperlinks, tryk på Ctrl + V at indsætte dem.

Kopier og indsæt hyperlinks
doc-kopi-hyperlinks 3
Kopier og indsæt hyperlinkadresse
doc-kopi-hyperlinks 4

Fanebladssøgning og redigering af flere Word Dokumenter/Excel arbejdsbøger som Firefox, Chrome, Internet Explore 10!

Du er måske bekendt med at se flere websider i Firefox/Chrome/IE, og skifte mellem dem ved nemt at klikke på tilsvarende faner. Her, Office Tab understøtter lignende behandling, som giver dig mulighed for at gennemse flere Word dokumenter eller Excel arbejdsbøger i én Word vindue eller Excel vindue, og skift nemt mellem dem ved at klikke på deres faner.
Klik for gratis prøveversion af Office Tab!

Gennemse flere word dokumenter i ét vindue som Firefox

Relative artikler:


Anbefales Word Produktivitetsværktøjer

 

Kutools For Word - Mere end 100 avancerede funktioner til Word, Spar din 50 % tid

  • Komplicerede og gentagne operationer kan udføres engangsbehandling på få sekunder.
  • Indsæt flere billeder på tværs af mapper i Word dokument med det samme.
  • Flet og kombiner flere Word filer på tværs af mapper i én med din ønskede rækkefølge.
  • Opdel det aktuelle dokument i separate dokumenter efter overskrift, sektionsskift eller andre kriterier.
  • Konverter filer mellem Doc og Docx, Docx og PDF, samling af værktøjer til almindelige konverteringer og markering osv. ...
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.
This comment was minimized by the moderator on the site
Indeed! ONE year later, am having similar issues and totally bawled over by your wonderful help!! God Bless YOu!!
This comment was minimized by the moderator on the site
it is prompting " Compile Error: Syntax Error" Please help me, I need to do a lot of work using this .Reply asap
This comment was minimized by the moderator on the site
wow, its great. Thank you so much
This comment was minimized by the moderator on the site
Omg this is legendary stuff. So helpful. Thanks a lot! :-)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations