Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 11-14-2025, 03:44 AM
gmaxey gmaxey is offline Find and select a passive URL string Windows 10 Find and select a passive URL string Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,652
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Quote:
Originally Posted by RobiNew View Post
Obviously I was referring to gmaxey's code, which contains "Do While .Find.Execute".
The first part of your code returns ".Execute" Not valid!!
The second part ("http://[! ]{1,}") doesn't find anything at all.
Up to now the only working code is the one I posted, though unfortunately it returns only "http://w", not the whole inactive link.

Robinew,


I have to agree with Paul. I have tried every way that I can think of to break Paul's code or mine in such a way it returns the error your report. I just doesn't happen or make sense. Regardless, here is a version of your original code that you can try:

Code:
Sub SelectNextURL()
Dim oDoc As Document, oRng As Range
  Set oDoc = ActiveDocument
  Set oRng = oDoc.Range
  With oRng.Find
    .ClearFormatting
    .Text = ""
    .MatchWildcards = True
    'Word wildcards: http[s]:// followed by any non-space characters
    .Text = "(http*)(://*)([! ^13^32^9^t<>'""]{1,})"
    If .Execute Then
      oRng.Select
      MsgBox "URL found and selected: " & oRng.Text, vbInformation
    Else
      MsgBox "No URL found.", vbExclamation
    End If
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



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 02:46 PM.


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