WorkbookBase.PrintPreview Method
Shows a preview of the object as it would look when printed.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
Public Sub PrintPreview ( _
enableChanges As Object _
)
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.
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
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 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
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);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.