![]() |
#11
|
||||
|
||||
![]()
I also think we need to see the context and reason for what you are trying to achieve. Looking at your code, it appears like it might be rewritten to loop along the following lines.
Code:
Sub get_irf_fnf() Dim s1 As String, s2 As String s1 = "(\<irf fnf=)(" & ChrW(8220) & "[A-Z 0-9]{1,}" & ChrW(8221) & "/\>)(*)^13" s2 = "(\<irf fnfr=)(" & ChrW(8220) & "[A-Z 0-9]{1,}" & ChrW(8221) & "/\>)-(\<)irf fnf=(" & ChrW(8220) & "[A-Z 0-9]{1,}" & ChrW(8221) & "/\>)" Selection.HomeKey Unit:=wdStory With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = s1 .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True Do While .Execute = True Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.Cut Selection.HomeKey Unit:=wdStory .Text = s2 .Execute Selection.PasteAndFormat (wdFormatOriginalFormatting) Selection.HomeKey Unit:=wdStory .Text = s1 Loop End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
stacey_e | Mail Merge | 7 | 07-07-2023 01:27 AM |
Repeat macro until no more fields | ChrisJ83 | Word VBA | 2 | 01-20-2016 04:55 AM |
![]() |
ChristopherHughes | Excel | 1 | 12-07-2014 08:31 PM |
![]() |
pbyrescue | PowerPoint | 1 | 04-03-2014 12:40 PM |
Repeat formula 5 times and repeat? | Jenny345 | Excel | 4 | 06-14-2013 04:37 PM |