Share via


NamedRange.PrintPreview(Object) Method

Definition

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

public object PrintPreview (object EnableChanges);
abstract member PrintPreview : obj -> obj
Public Function PrintPreview (Optional EnableChanges As Object) As Object

Parameters

EnableChanges
Object

true to enable changes while print preview is displayed; otherwise, false.

Returns

Examples

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");

    namedRange1.Formula = "=Rand()";
    namedRange1.PrintPreview();
}
Private Sub ShowPrintPreview()
    Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
        = Me.Controls.AddNamedRange(Me.Range("A1", "E5"), _
        "namedRange1")

    namedRange1.Formula = "=Rand()"
    namedRange1.PrintPreview()
End Sub

Remarks

Optional Parameters

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

Applies to