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)

Syntax

'Declaration
Function PrintPreview ( _
    EnableChanges As Object _
) As Object
Object PrintPreview(
    Object EnableChanges
)

Parameters

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

Return Value

Type: System.Object

Remarks

Optional Parameters

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

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 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

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

    namedRange1.Formula = "=Rand()";
    namedRange1.PrintPreview(missing);
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace