![]() |
|
#22
|
||||
|
||||
|
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] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
problem with MS word merging words and sentences
|
aretai | Word | 5 | 07-17-2018 12:32 AM |
| Exceptions for 'Capitalize first letter of sentences' | gazpacho | Word | 1 | 01-12-2012 11:43 AM |
How to filter sentences wth highlighted colour
|
rajpes | Word | 4 | 02-25-2011 12:43 AM |
keep only sentences beginning with: Wind
|
Michael007 | Word VBA | 3 | 01-17-2011 04:11 PM |
| capitalize first letter of sentences | norco1 | Word | 0 | 06-25-2006 12:37 PM |