View Single Post
 
Old 12-10-2018, 12:52 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
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

Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim StrPfx As String, StrSfx As String, StrMid As String, StrTmp As String
Dim i As Long, j As Long, k As Long
StrPfx = "\<irf fnf=“": StrSfx = "”/\>"
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "(" & StrPfx & "[A-Z]@)[0-9]@" & StrSfx & "-\1[0-9]@" & StrSfx
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    StrTmp = Split(Split(.Text, Replace(StrSfx, "\", ""))(0), "“")(1)
    StrMid = StrTmp
    For i = 1 To Len(StrTmp)
      If Right(StrMid, 1) Like "[0-9]" Then
        StrMid = Left(StrMid, Len(StrMid) - 1)
      End If
    Next
    i = CLng(Replace(StrTmp, StrMid, ""))
    StrTmp = Split(Split(.Text, Replace(StrSfx, "\", ""))(1), "“")(1)
    StrMid = StrTmp
    For j = 1 To Len(StrTmp)
      If Right(StrMid, 1) Like "[0-9]" Then
        StrMid = Left(StrMid, Len(StrMid) - 1)
      End If
    Next
    j = CLng(Replace(StrTmp, StrMid, ""))
    StrTmp = ""
    For k = i To j
      StrTmp = StrTmp & StrPfx & StrMid & k & StrSfx & Chr(11)
    Next
    StrTmp = Replace(StrTmp, "\", "")
    .Text = Left(StrTmp, Len(StrTmp) - 1)
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
With the above code, there is no need for your data outside the table.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote