View Single Post
 
Old 04-15-2014, 02:40 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
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
With ActiveDocument.Range
  .InsertParagraphAfter
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "Answer \([A-E]\)[!^13]@^13"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    Do While Left(.Paragraphs.Last.Next.Range.Text, 10) Like "Answer ([A-E])"
      .End = .Paragraphs.Last.Next.Range.End
    Loop
    .Sort
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
With ActiveDocument.Range.Characters.Last
  While .Previous.Text = vbCr
   .Previous.Text = vbNullString
  Wend
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote