separate the hyperlink from text in a mail in a mail in outlook

Discussion in 'Computer Software' started by oakse, May 16, 2017.

  1. oakse

    oakse New Member
    Recruit

    hello,

    I always need to get the hyperlink in the email. But I need to put the cursor over the text which have been inserted the hyperlink to see the real hyperlink.

    Can just separate the hyperlink from displaying text in a mail, so that I can get the hyperlink addresses straightly?
     
  2. Marilcarty

    Marilcarty New Member
    Recruit

    You can write VBA code to do that . I search it on google and find a code as below:

    Code:
    Sub ShowAllHyperlinkAddresses()
        Dim objMail As Outlook.MailItem
        Dim objWordDocument As Word.Document
        Dim objWordApp As Word.Application
        Dim objWordSelection As Word.Selection
        Dim objHyperlinks As Word.Hyperlinks
        Dim objHyperlink As Word.Hyperlink
        Dim strLink As String
        Set objMail = Outlook.Application.ActiveInspector.CurrentItem
        Set objWordDocument = objMail.GetInspector.WordEditor
        Set objWordApp = objWordDocument.Application
        Set objHyperlinks = objWordDocument.Hyperlinks
        If objHyperlinks.Count > 0 Then
           For Each objHyperlink In objHyperlinks
               strLink = objHyperlink.Address
               strLink = vbTab & "<" & strLink & ">"
               objHyperlink.Range.InsertAfter strLink
               objHyperlink.Delete
               With objWordApp.Options
                    .AutoFormatReplaceHyperlinks = True
                    .AutoFormatApplyOtherParas = False
                    .AutoFormatApplyHeadings = False
                    .AutoFormatApplyBulletedLists = False
                    .AutoFormatApplyLists = False
                    .AutoFormatApplyFirstIndents = False
              End With
              Set objWordSelection = objWordApp.Selection
              objWordSelection.Range.AutoFormat
           Next
        End If
    End Sub
    Hope it helps.
     
    #2 Marilcarty, May 19, 2017
    Last edited by a moderator: May 19, 2017

Share This Page