ParagraphFormat.KeepWithNext Property (Publisher)

Sets or returns an MsoTriState that indicates whether the following paragraph will remain in the same text box as the specified paragraph. Read/write.

Syntax

expression .KeepWithNext

expression A variable that represents a ParagraphFormat object.

Return Value

MsoTriState

Remarks

The purpose of keep with next is to prevent hanging headings in a document. To do, you may set this property to msoTrue for all headings.

The default setting for this property is msoFalse.

Example

This example sets the KeepWithNext property to msoTrue for the specified ParagraphFormat object.

Dim objParaForm As ParagraphFormat 
Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _ 
 .TextFrame.TextRange.Paragraphs(1).ParagraphFormat 
objParaForm.KeepWithNext = msoTrue