Word Macro to Extract Hyperlinks from a document

Discussion in 'Word Programming' started by sandeep6699@yahoo.com, Apr 26, 2013.

  1. Guest

    Hello,

    From the website http://www.tek-tips.com/viewthread.cfm?qid=1689945 I
    got the following macro to extract hyperlinks embedded in a Word
    document:



    Function doHL()
    Dim nd As Document
    Dim a As Document
    Dim h As Hyperlink
    Dim r As Range

    Application.ScreenUpdating = False

    Set a = ActiveDocument
    Set nd = Documents.Add

    For Each h In a.Hyperlinks
    Set r = nd.Range
    r.Collapse
    r.InsertParagraph
    r.InsertAfter (h.Address)
    Next

    nd.Activate
    Application.ScreenUpdating = True
    Application.ScreenRefresh
    End Function






    The macro works like a charm, except that it lists the hyperlinks in
    reverse order. Can someone kindly suggest a tweak to reverse (i.e.
    correct) the order of hyperlinks in the document.

    Thanks,
    SS
     
    , Apr 26, 2013
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.