Macro to expand all hyperlinks in place in a word document

Discussion in 'Word Programming' started by sandeep6699@yahoo.com, Jun 22, 2013.

  1. Guest

    Hello,

    I would appreciate if someone could suggest how I can expand all hyperlinks in a word document AT THE CORRECT PLACE. I know that with Alt+F9 you can switch between the label view and the hyperlink view, but I want to see both at the same time.

    Thanks,
    SS
     
    , Jun 22, 2013
    #1
    1. Advertisements

  2. Guest

    On Saturday, June 22, 2013 11:32:40 AM UTC-7, wrote:
    > Hello,
    >
    >
    >
    > I would appreciate if someone could suggest how I can expand all hyperlinks in a word document AT THE CORRECT PLACE. I know that with Alt+F9 you can switch between the label view and the hyperlink view, but I want to see both at the same time.
    >
    >
    >
    > Thanks,
    >
    > SS


    Thanks to the following website, I was able to come up with the macros that I wanted:
    http://www.msofficeforums.com/word-vba/11940-word-macro-reformats-embedded-links-doc.html


    Sub TagHyperlinks()
    Dim HLnk As Hyperlink
    For Each HLnk In ActiveDocument.Hyperlinks
    HLnk.Range.InsertAfter " (" & HLnk.Address & ") "
    Next
    End Sub


    Sub TagHyperlinks_selected()
    Dim HLnk As Hyperlink
    With Selection.Find
    For Each HLnk In Selection.Hyperlinks
    HLnk.Range.InsertAfter " (" & HLnk.Address & ") "
    Next
    End With
    End Sub



    SS
     
    , Jun 23, 2013
    #2
    1. Advertisements

  3. Stefan Blom Guest

    Thanks for sharing it with us. :)

    --
    Stefan Blom
    Microsoft Word MVP



    sandeep6699 wrote in message
    news:...
    >
    > On Saturday, June 22, 2013 11:32:40 AM UTC-7, wrote:
    > > Hello,
    > >
    > >
    > >
    > > I would appreciate if someone could suggest how I can expand all
    > > hyperlinks in a word document AT THE CORRECT PLACE. I know that with
    > > Alt+F9 you can switch between the label view and the hyperlink view, but
    > > I want to see both at the same time.
    > >
    > >
    > >
    > > Thanks,
    > >
    > > SS

    >
    > Thanks to the following website, I was able to come up with the macros
    > that I wanted:
    > http://www.msofficeforums.com/word-vba/11940-word-macro-reformats-embedded-links-doc.html
    >
    >
    > Sub TagHyperlinks()
    > Dim HLnk As Hyperlink
    > For Each HLnk In ActiveDocument.Hyperlinks
    > HLnk.Range.InsertAfter " (" & HLnk.Address & ") "
    > Next
    > End Sub
    >
    >
    > Sub TagHyperlinks_selected()
    > Dim HLnk As Hyperlink
    > With Selection.Find
    > For Each HLnk In Selection.Hyperlinks
    > HLnk.Range.InsertAfter " (" & HLnk.Address & ") "
    > Next
    > End With
    > End Sub
    >
    >
    >
    > SS
     
    Stefan Blom, Jun 26, 2013
    #3
    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.