For some reason it seems to make sense to be able to run a macro on a set of paragraphs rather than go through the menu system (Format, Paragraphs, LinePageBreaks, KeepWithnext) and how many times do I toggle that switch right past the solid tick and have to go around again?


Bearing in mind the recent discussion on endless-repagination, I should maybe test that the selected text can fit on one page?


<pre>Public Sub cmd_KeepWithNext()
' Procedure : cmd_KeepWithNext
' Description: For the selected paragraphs, keep with next all but last one.
' Copyright: Chris Greaves Inc.
' Inputs: None.
' Returns: None
' Assumes: Nothing
' Side Effects: None.
' Tested: By a call from the user.

' Handy when you have groups of paragraphs that must stay on the same page.
' Select all the paragraphs, run the macro.

Dim i As Integer
For i = 1 To Selection.Paragraphs.Count - 1
Selection.Range.Paragraphs(i).KeepWithNext = True
Next i
End Sub
</pre>