Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Sep 2001
    Location
    Bangkok, Thailand
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copying Hotlink URLs (Word 2002)

    I have a word document that has a long list of hyperlinks that have nice descriptive visible names (eg Check this site) with web URLs (eg http://www.junkforever.com - ) buried underneath. I have been trying to find an easy way to copy the URLs, but other than hovering over the hotlink and manually writing down the URL I've found no way. As my list has hundreds of URLs I really don't want to resort to pencil and paper (How pre-Gutenburg)

    Surely there is an easier method, preferably one that will harvest all the URLs and save them in a plain old text document or on the clipboard so they can be pasted into another application.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copying Hotlink URLs (Word 2002)

    The following macro will create a new document and list all hyperlinks in the document that was active when the macro is invoked.

    Sub ListHyperlinks()
    Dim docCurrent As Document
    Dim docList As Document
    Dim hypLink As Hyperlink
    Set docCurrent = ActiveDocument
    Set docList = Documents.Add
    For Each hypLink In docCurrent.Hyperlinks
    docList.Range.InsertAfter hypLink.TextToDisplay & vbTab & _
    hypLink.Address & vbTab & hypLink.SubAddress & vbCrLf
    Next hypLink
    Set hypLink = Nothing
    Set docList = Nothing
    Set docCurrent = Nothing
    End Sub

    Note: the underscore _ is a line continuation characte to indicate that the instruction is continued on the next line. There must be a space before it.

  3. #3
    Star Lounger
    Join Date
    Sep 2001
    Location
    Bangkok, Thailand
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copying Hotlink URLs (Word 2002)

    Hans,

    Many thanks for the extremely prompt and "right on" response. Your little macro does exactly what I wanted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •