View Single Post
 
Old 12-22-2015, 08:12 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

The macro equivalent of the wildcard Find/Replace is:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  .InsertBefore vbCr
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^13[0-9]{1,}.^32"
    .Replacement.Text = "^p"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
  While .Characters.First = vbCr
    .Characters.First.Delete
  Wend
End With
Application.ScreenUpdating = True
End Sub
It's unclear whether you intend to retain a paragraph break between the segments. If not, delete the ^p from the code. Likewise, it's unclear whether you want to remove the space following the number. If not, delete the ^32.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote