View Single Post
 
Old 07-13-2021, 10:46 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
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 ofgmayor has much to be proud of
Default

Greg is currently enjoying a much needed break so wouldn't be around to comment anyway. To retain the double paragraph breaks the following addition should work
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
'Graham Mayor - https://www.gmayor.com - Last updated - 14 Jul 2021
Dim oRng As Word.Range
    Set oRng = Selection.Range
    If oRng.Characters.Last = Chr(13) Or oRng.Characters.Last = Chr(11) Then
        oRng.End = oRng.End - 1
    End If
    oRng.Text = Replace(oRng.Text, Chr(13) & Chr(13), "&%&%&%")
    oRng.Text = Replace(Replace(oRng.Text, Chr(11), " "), Chr(13), " ")
    oRng.Text = Replace(oRng.Text, "&%&%&%", Chr(13) & Chr(13))
lbl_Exit:
    Exit Sub
End Sub
though frankly for the future it would be better to use paragraph styles with added spacing to format the document to separate paragraphs than to use empty paragraphs. It makes the document much easier to edit.
__________________
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