Spacing text for email response

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Spacing text for email response

Post by ChrisGreaves »

I wrote this after editing an MSWord response to an email.
I and the sender use two styles.
I wanted a broad space after each set of paragraphs (sender or recipient) and the same broad space after only the last in my series of paragraphs in response.

Code: Select all

 Function ParagraphAfter(doc As Document, lngPointsAfter As Long, blnTogether As Boolean)
    Dim lng As Long
    Dim strStyleOld As String
    For lng = doc.Paragraphs.Count - 1 To 1 Step -1
        Dim prg As Range
        Set prg = ActiveDocument.Paragraphs(lng).Range
        With prg
            .ParagraphFormat.KeepTogether = blnTogether
            If strStyleOld <> .Style Then
                strStyleOld = .Style
                With .ParagraphFormat
                    .SpaceAfter = lngPointsAfter
                    .KeepWithNext = False
                End With
            Else
            End If
        End With
    Next lng
'Sub TESTParagraphAfter()
'    Call ParagraphAfter(ActiveDocument, 48, False)
'End Sub
End Function 
He who plants a seed, plants life.