The macro here below works perfectly when the string is followed by a space. How do I modify the code so as to make it work also when the string is followed by , ; . : etc.? Can someone help?
Code:
Dim Rng As Range
Dim SearchString As String
Dim Link As String
Set Rng = ActiveDocument.Range
SearchString = "http"
With Rng.Find
.MatchWildcards = True
Do While .Execute(findText:=SearchString, Forward:=False) = True
Rng.MoveStartUntil ("http")
Rng.MoveEndUntil Cset:=" "
Link = Rng.Text
ActiveDocument.Hyperlinks.Add Anchor:=Rng, _
Address:=Link, _
SubAddress:="", ScreenTip:="", TextToDisplay:=Rng.Text
Rng.Font.Color = 15597568 'codice di Word
Rng.Collapse wdCollapseStart
Loop
End With