Share via


NamedRange.PageBreak Property

Gets or sets the ___location of a page break.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
Property PageBreak As Integer
    Get
    Set
int PageBreak { get; set; }

Property Value

Type: System.Int32
The ___location of a page break.

Remarks

You can set this property using one of the following XlPageBreak values:

This property can return the ___location of either automatic or manual page breaks, but it can only set the ___location of manual breaks (it can only be set to xlPageBreakManual or xlPageBreakNone).

Examples

The following code example creates a NamedRange and then uses the PageBreak property to set a page break at the NamedRange.

This example is for a document-level customization.

Private pageBreakRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub SetPageBreak()
    pageBreakRange = Me.Controls.AddNamedRange( _
        Me.Range("C4"), "pageBreakRange")
    Me.pageBreakRange.PageBreak = _
        Fix(Excel.XlPageBreak.xlPageBreakManual)
End Sub
Microsoft.Office.Tools.Excel.NamedRange pageBreakRange;
private void SetPageBreak()
{
    pageBreakRange = this.Controls.AddNamedRange(
         this.Range["C4", missing], "pageBreakRange");
    this.pageBreakRange.PageBreak =
        (int)Excel.XlPageBreak.xlPageBreakManual;
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace