Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 02-18-2025, 01:52 PM
macropod's Avatar
macropod macropod is offline problem with capturing group in findText/ReplaceWith Windows 10 problem with capturing group in findText/ReplaceWith Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Frankly, I still can't see what you need the loop for. The same result could be achieved with nothing more than:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Execute FindText:="…([A-Za-zÀ-ÖØ-öø-ÿ0-9])", ReplaceWith:="... \1", _
    MatchWildcards:=True, Format:=False, Wrap:=wdFindContinue, Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
The only reason I can think of that you might be getting something like '...H ello' is if there is a tracked change at that point.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with capturing group in findText/ReplaceWith Find and Replace not capturing entire line Steve Kunkel Word VBA 7 04-22-2021 10:00 AM
problem with capturing group in findText/ReplaceWith Capturing numbered headings jbvalen Word VBA 5 05-04-2017 05:03 PM
problem with capturing group in findText/ReplaceWith Capturing Redirected URL with macro souravkp Word VBA 1 07-11-2015 09:34 PM
problem with capturing group in findText/ReplaceWith Capturing addresses into contacts lordnacho Outlook 1 11-01-2010 06:05 PM
time capturing aligahk06 Excel 0 04-18-2010 11:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:52 PM.


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