View Single Post
 
Old 11-04-2023, 08:15 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

RobiNew, here you are, enjoy it!
Code:
Sub OneLiners()
'In selection, replace Chr(13) with Chr(11) between all consecutive one-line paras.

Dim oRng
Application.ScreenUpdating = False
Set oRng = selection.range
    For Each Para In oRng.Paragraphs
        If Para.range.End >= oRng.End Then Exit Sub
        If Para.range.ComputeStatistics(wdStatisticLines) = 1 And _
            Para.Next.range.ComputeStatistics(wdStatisticLines) = 1 Then
            Para.range.Characters.Last.text = Chr(11)
            Do While Para.Next.range.ComputeStatistics(wdStatisticLines) = 1
                Para.range.Characters.Last.text = Chr(11)
            Loop
        End If
    Next
Application.ScreenUpdating = True
Set oRng = Nothing
End Sub
Reply With Quote