This property applies to a table or a table style using Table.AllowPageBreaks or. This property does not work, and is effectively unusable. In a table or a table style: keep the whole table on one page (.AllowPageBreaks) This property reliably returns True or False, just as you'd expect. AllowBreakAcrossPages property, even if you change the underlying table style's. Note that individual rows retain the value of their. For example: ActiveDocument.Tables(1).Rows(2).AllowBreakAcrossPages = False This is the setting controlled in the user interface in the Table Properties dialog box, on the Row tab. It determines whether the row(s) may break across a page. or Table.Rows(n).AllowBreakAcrossPages applies to an individual Row or all the. This property applies to a real, live table. In a table: prevent or allow page breaks within specified rows (.AllowBreakAcrossPages) What it does
#How to insert page break in word table how to#
This works quite reliably: ActiveDocument.Styles("MyTableStyle").Table.AllowBreakAcrossPage = True How to use this property
False, the return value is 0 (which is kind of what you'd expect) and Word acknowledges that the value is. True, the return value is 1 (which is not what you'd expect), and Word denies that the value is. ?ActiveDocument.Styles("MyTableStyle").Table.AllowBreakAcrossPage = False ' returns False
#How to insert page break in word table code#
Here is some sample VBA code from the immediate window: ?ActiveDocument.Styles("MyTableStyle").Table.AllowBreakAcrossPage = True ' returns False Reading the propertyįor a newly-created style, the default value is 1. But a newly-created style returns a value of 1 (not -1) for this property. The documentation says that this property returns a Long (not a Boolean), and that the default value is True. If I create a new table style, I observe that rows break across the page. And I can use the user interface to allow an individual row to break across a page if I need to.Īs far as I can see, you can't use this property to define a table style such that some rows will break and others won't. But we can achieve the same thing using. Setting this property on the table style tells Word to do just what I want. In most tables I create, I don't want any rows to break across a page. However, in the user interface, you can override the setting for one individual row in a table to which this table style has been applied. So it applies to all rows in the table.Īs far as I can see, there is no way to set this property from the user interface. But this is a property of the table style, not individual rows. It determines whether the individual rows in a table may break across a page. It controls the behaviour of individual rows, not the whole table. AllowBreakAcrossPage property applies to the Table of a table style. In a table style: prevent or allow page breaks within rows (.AllowBreakAcrossPage ) What it does This page describes my observations about how these four settings work. The Microsoft Word object model has four settings that control page breaks in tables and table styles: KeepWithNext sometimes keeps this paragraph on the same page as the next paragraph. AllowBreakAcrossPages controls page breaks within one or more rows. AllowBreakAcrossPage controls page breaks within all rows. Controlling page breaks in tables and table styles