X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Text Inserted Using If Then Else Includes Hyperlinks, Office 2013    
post Apr 15 2019, 09:23 AM

Posts: 415
Joined: 10-December 12


I'm using the If then else option in Word 2016 to have a short paragraph inserted in a merge email if a condition is met. I have that part working fine. However, the short paragraph includes 2 hyperlinks, which are not inserted as hyperlinks, but rather just plain text. How can I get the hyperlinks in the inserted text to be hyperlinks?

Thank you!
Go to the top of the page
post Apr 21 2019, 08:16 AM

Posts: 2,705
Joined: 4-February 07
From: USA, Florida, Delray Beach

Try the following Macro:
Sub ConvertTextToHyperlink()
Dim Rng As Range

Set Rng = ActiveDocument.Range

With Rng.Find
  Do While .Execute(findText:="http:", Forward:=False) = True
    Rng.MoveEndUntil (" ")
    ActiveDocument.Hyperlinks.Add Anchor:=Rng, _
                   Address:=Rng.Text, SubAddress:="", _
                   ScreenTip:="", TextToDisplay:=Rng.Text
    Rng.Collapse wdCollapseStart
End With
End Sub

This post has been edited by ADezii: Apr 21 2019, 08:17 AM
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    10th December 2019 - 02:49 PM