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

Hi jgarland,

There was some serious scope creep in those last two posts - especially the last one. Try:
Code:
Sub ParaMerge()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument
  Set Rng = .Range
  Rng.Start = .Range.Paragraphs(2).Range.Start
  With Rng
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "(*)^13(*)^13(*)^13(*)^13(*^13)"
      .Replacement.Text = "\1 \2 \3 \4 \5"
      .Forward = True
      .Wrap = wdFindContinue
      .Format = False
      .MatchWildcards = True
      .Execute Replace:=wdReplaceAll
    End With
    If .Sentences.Count > 20 Then
      Do
        With .Paragraphs.Last.Previous.Range
          If .Sentences.Count < 20 Then
            .Characters.Last.Delete
            .InsertAfter " "
          Else
            Exit Do
          End If
        End With
      Loop
    Else
      With .Find
        .Text = "^13"
        .Replacement.Text = " "
      .Execute Replace:=wdReplaceAll
      End With
    End If
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote