This documentation is archived and is not being maintained.

NamedRange.PrintPreview Method

Shows a preview of the NamedRange control as it would look when printed.

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

Object PrintPreview(
	Object EnableChanges


Type: System.Object
true to enable changes while print preview is displayed; otherwise, false.

Return Value

Type: System.Object

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example sets the values of the cells in a NamedRange control to random numbers, and then uses the PrintPreview method to generate a print preview of the contents of the named range.

This example is for a document-level customization.

private void ShowPrintPreview()
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", "E5"],

    namedRange1.Formula = "=Rand()";