Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2025, 10:28 AM
RobiNew RobiNew is offline Find and select a passive URL string Windows 11 Find and select a passive URL string Office 2016
Competent Performer
Find and select a passive URL string
 
Join Date: Sep 2023
Posts: 236
RobiNew is on a distinguished road
Default

That's great! Thank you, gmaxey. Your simplified version works perfectly. I thought we'd never find a solution. All the best!
Reply With Quote
  #2  
Old 11-16-2025, 02:47 AM
RobiNew RobiNew is offline Find and select a passive URL string Windows 11 Find and select a passive URL string Office 2016
Competent Performer
Find and select a passive URL string
 
Join Date: Sep 2023
Posts: 236
RobiNew is on a distinguished road
Default

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 "[,.:]" Then
oRng.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
Reply With Quote
Reply



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
Find and select a passive URL string Why is this Find string not working TechEd Word VBA 5 07-05-2014 08:12 PM
Find and select a passive URL string Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:58 AM.


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