KeepWithNext Property

Microsoft Publisher Visual Basic

Show All Show All

KeepWithNext Property

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

msoCTrue
msoFalse Next paragraph will remain in the same text box.
msoTriStateMixed
msoTriStateToggle
msoTrue Next paragraph may not remain in the same text box.

expression.KeepWithNext

expression    Required. An expression that returns a ParagraphFormat object.

Remarks

The purpose of keep with next is to prevent hanging headings in a document. To do this a user 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