Condividi tramite


WorkbookBase.PrintPreview(Object) Method

Definition

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

public void PrintPreview (object enableChanges);
member this.PrintPreview : obj -> unit
Public Sub PrintPreview (Optional enableChanges As Object)

Parameters

enableChanges
Object

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

Examples

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);
}
Private Sub 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
    Me.PrintPreview(True)
End Sub

Remarks

Optional Parameters

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

Applies to