![]() |
|
|
|
#1
|
|||
|
|||
|
That's great! Thank you, gmaxey. Your simplified version works perfectly. I thought we'd never find a solution. All the best!
|
|
#2
|
|||
|
|||
|
Hi! Now I am trying to use the code posted by gmaxey in a loop, but it doesn't work because this line "oRng.Collapse Direction:=wdCollapseEnd" remains inactive. Here is the code (I'm using the # button, but it doesn't seem to work):
Sub HTTP_Loop() Dim oRng As Range Dim oPar As Paragraph Dim SearchString As String Dim strLS As String strLS = Application.International(wdListSeparator) Set oRng = ActiveDocument.StoryRanges(wdMainTextStory) SearchString = "(http*)(://*)([! ^13^32^9^t<>'""]{1" & strLS & "})" With oRng.Find .MatchWildcards = True Do While .Execute(FindText:=SearchString, Forward:=True) = True oRng.Select MsgBox "Continue with [OK]." If oRng.Characters.Last Like "[,.: ]" ThenoRng.MoveEnd Unit:=wdCharacter, Count:=-1 End If ActiveDocument.Hyperlinks.Add Anchor:=oRng, Address:=oRng.Text, _ SubAddress:="", ScreenTip:="", TextToDisplay:=oRng.Text oRng.Collapse Direction:=wdCollapseEnd oRng.Select Loop End With End Sub |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find string, Replace with dot tab | dhapp | Word | 5 | 03-27-2023 07:23 AM |
| Find and select all string of simlar pattern | anon123 | Word | 4 | 04-20-2016 11:41 PM |
| How to find all string within string. | PRA007 | Word VBA | 18 | 02-12-2016 08:11 PM |
Why is this Find string not working
|
TechEd | Word VBA | 5 | 07-05-2014 08:12 PM |
Bad view when using Find and Find & Replace - Word places found string on top line
|
paulkaye | Word | 4 | 12-06-2011 11:05 PM |