View Single Post
 
Old 01-18-2020, 10:07 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It is bad practice to insert empty paragraphs. Word is not a typewriter, which is the origin of inserting space using empty paragraphs, so spacing should be applied with styles. You probably have existing styles with space that would so the job, but the following will create styles and add them as appropriate to give the required spacing. If you have suitable styles, remove the style creation and apply them instead.

Code:
Sub Macro1()
Dim i As Long
Dim oPara As Paragraph

    'Create styles or use existing styles
    ActiveDocument.Styles.Add Name:="Body_Spaced", Type:=wdStyleTypeParagraph
    ActiveDocument.Styles("Body_Spaced").AutomaticallyUpdate = False
    With ActiveDocument.Styles("Body_Spaced").Font
        .Name = "Calibri"
        .Size = 12
    End With
    With ActiveDocument.Styles("Body_Spaced").ParagraphFormat
        .SpaceAfter = 12
    End With
    ActiveDocument.Styles.Add Name:="Body_Unspaced", Type:= _
                              wdStyleTypeParagraph
    ActiveDocument.Styles("Body_Unspaced").AutomaticallyUpdate = False
    With ActiveDocument.Styles("Body_Unspaced").Font
        .Name = "Calibri"
        .Size = 12
    End With
    With ActiveDocument.Styles("Body_Unspaced").ParagraphFormat
        .SpaceAfter = 0
    End With
    'end of style creation
    'apply styles
    For i = 1 To ActiveDocument.Paragraphs.Count
        Set oPara = ActiveDocument.Paragraphs(i)
        If i Mod 3 = 0 Then
            oPara.Range.Style = "Body_Spaced"
        Else
            oPara.Range.Style = "Body_Unspaced"
        End If
    Next i
    Set oPara = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote