Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-03-2023, 01:50 AM
RobiNew RobiNew is offline Add hyperlink to each http(s) string Windows 10 Add hyperlink to each http(s) string Office 2016
Competent Performer
Add hyperlink to each http(s) string
 
Join Date: Sep 2023
Posts: 183
RobiNew is on a distinguished road
Question Add hyperlink to each http(s) string

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
http/1.0 404 not found Powerpoint User PowerPoint 2 11-20-2016 11:10 PM
Find whether string contains hyperlink and Process the same PRA007 Word VBA 15 12-01-2015 02:57 AM
Multiple Hyperlink to a single string PRA007 Word VBA 7 11-09-2015 04:29 PM
Outlook http server joelwelford Outlook 0 09-07-2015 10:00 AM
Add hyperlink to each http(s) string Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft