> Thanks very much Russ. You've explained it very well, and I understand what
> the code is doing.
[quoted text clipped - 107 lines]
>>>>>>>>>
>>>>>>>>> Thanks

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Hi Russ,
sorry, could not resist,
at least for cleaning the doc's end.
You can't replace the end-of-doc mark.
>>>> .Text = "^13{2,}" 'Two or More?
>>>> .Replacement.Text = "^p"
>>>> .Execute Replace:=wdReplaceAll
If there is an empty paragraph at the doc's end,
You won't get rid of it that way.
If google groups search is available again,
seems to be down for a while, search for PurgeDocEnd
and my decent name.
Sub Test33()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
While Len(rDcm.Paragraphs.Last.Range.Text) = 1
rDcm.Paragraphs.Last.Range.Delete
Wend
End Sub
Many other ways, of course.
Which doesn' deal with trailing paragraphs containing
only white pace. But that's another question.
Hmm, and when replacing two chr(13) with "^p",
what formatting, if different, should win?
Have a nice day.
Russ - 09 Jul 2007 23:27 GMT
Helmut,
This was in my first reply to her initial question. Notice the second
sentence.
>Quote
Here's a routine I use to purge the mainstory of document of its 'empty'
lines.
I use it maybe before or after a paragraph sort for lists, for instance.
Public Sub Delete_Empty_Lines()
>Dim objRange as Range 'was added in a follow-up message
Set objRange = ActiveDocument.Range(0, 0)
With objRange.Find
.MatchWildcards = True
.Text = "^13"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
.Text = "^13{2,}"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
End With
Do While ActiveDocument.Paragraphs.Last.Range.Characters.Count = 1
ActiveDocument.Paragraphs.Last.Range.Delete
Loop
Do While ActiveDocument.Paragraphs.First.Range.Characters.Count = 1
ActiveDocument.Paragraphs.First.Range.Delete
Loop
End Sub
>UnQuote
Helmut, later in the message thread I was trying to explain the reasoning
behind each part of the macro and apparently that was the only thing you
noticed.
> Hi Russ,
>
[quoted text clipped - 30 lines]
>
> Have a nice day.

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID