View Single Post
 
Old 12-09-2018, 11:26 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,992
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
We would need to see a sample document to figure out whether that code would be workable.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote