View Single Post
 
Old 06-17-2014, 05:21 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,512
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 a macro like the following. Just don't expect the processing to be instantaneous in a 1430-page document!
Code:
Sub ParseDoc()
Application.ScreenUpdating = False
Dim i As Long, RngSrc As Range, RngTgt As Range
With ActiveDocument.Range
  For i = .Sentences.Count To 1 Step -1
    Set RngSrc = .Sentences(i)
    With RngSrc
      Do While .Characters.Last Like "[ " & vbCr & Chr(160) & "]"
        .End = .End - 1
        If .Start = .End Then Exit Do
      Loop
    End With
    If Len(RngSrc.Text) > 1 Then
      Set RngTgt = RngSrc.Duplicate
      With RngTgt
        .InsertAfter Chr(11)
        .Collapse wdCollapseEnd
        .FormattedText = RngSrc.FormattedText
        .InsertBefore "("
        .Characters.Last.InsertBefore ")("
        .InsertAfter ")" & Chr(11)
        With .Find
          .ClearFormatting
          .Replacement.ClearFormatting
          .Text = "[ ]{1,}"
          .Replacement.Text = ") ("
          .Forward = True
          .Wrap = wdFindStop
          .Format = False
          .MatchWildcards = True
          .Execute Replace:=wdReplaceAll
        End With
      End With
    End If
  Next
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchWildcards = True
    .Text = "^l^13"
    .Replacement.Text = "^p"
    .Execute Replace:=wdReplaceAll
    .Text = "^l "
    .Replacement.Text = "^l"
    .Execute Replace:=wdReplaceAll
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote