This documentation is archived and is not being maintained.

Workbook.PrintPreview Method (2007 System)

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

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

public void PrintPreview(
	Object EnableChanges
)

Parameters

EnableChanges
Type: System.Object

true to allow changes to the margins and page setup while displaying the print preview; otherwise, false.

Optional Parameters

For information on optional parameters, see The Variable missing and Optional Parameters in Office Solutions.

The following code example uses the PrintPreview method to show a print preview of the current workbook.

This example is for a document-level customization.

private void WorkbookPrintPreview()
{
    // Add a range value to make sure that the workbook generates  
    // a print preview. An empty workbook will not be printed.
    Globals.Sheet1.Range["A1", "A5"].Value2 = 55;
    this.PrintPreview(true);
}

Show: