View Single Post
 
Old 02-20-2019, 06:36 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

You could use something like:
Code:
Sub Demo()
Dim b As Boolean, Rng As Range
Const bForwards As Boolean = False
Set Rng = Selection.Range: b = False
With Selection
  With .Find
    .ClearFormatting
    .Text = "<Z[0-9A-Z]Z[0-9A-Z]@>"
    .Replacement.Text = ""
    .Forward = bForwards
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    If .InRange(Rng) = False Then Exit Do
    If Len(.Text) < 17 Then b = True
    If b = True Then Exit Do
    .Collapse bForwards + 1
    .Find.Execute
  Loop
End With
MsgBox b
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote