View Single Post
 
Old 04-06-2017, 10:06 AM
Thefirstfish` Thefirstfish` is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2015
Posts: 11
Thefirstfish` is on a distinguished road
Default

Thanks Macropod! Your code fixed the infinite loop issue for that function and similar ones. The macro seems to run faster too.

However, I'm not sure how to convert other infinite-loop-prone functions that only replace parts of strings to your suggested format. For example:

Code:
 With oRng.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[0-9]%-[0-9]"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .MatchWholeWord = False
    .Execute
  End With
  Do While oRng.Find.Found = True
    oRng.Characters(2).Text = ""
    oRng.Collapse Direction:=wdCollapseEnd
    oRng.Find.Execute
  Loop
Is there a simple way to do that? Many thanks.

Last edited by macropod; 04-06-2017 at 03:04 PM. Reason: Replaced quote tags around code with code tags
Reply With Quote