WorksheetBase.PrintOutEx Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Prints the worksheet.
public void PrintOutEx (object from, object to, object copies, object preview, object activePrinter, object printToFile, object collate, object prToFileName, object ignorePrintAreas);
member this.PrintOutEx : obj * obj * obj * obj * obj * obj * obj * obj * obj -> unit
Public Sub PrintOutEx (Optional from As Object, Optional to As Object, Optional copies As Object, Optional preview As Object, Optional activePrinter As Object, Optional printToFile As Object, Optional collate As Object, Optional prToFileName As Object, Optional ignorePrintAreas As Object)
Parameters
- from
- Object
The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
- to
- Object
The number of the last page to print. If this argument is omitted, printing ends with the last page.
- copies
- Object
The number of copies to print. If this argument is omitted, one copy is printed.
- preview
- Object
true
to have Microsoft Office Excel invoke print preview before printing the object. false
to print the object immediately.
- activePrinter
- Object
Sets the name of the active printer.
- printToFile
- Object
true
to print to a file. If PrToFileName
is not specified, Excel prompts the user to enter the name of the output file.
- collate
- Object
true
to collate multiple copies.
- prToFileName
- Object
If PrintToFile
is set to true
, this argument specifies the name of the file you want to print to.
- ignorePrintAreas
- Object
true
to ignore print areas and print the entire workbook; otherwise, false
.
Examples
The following code example uses the PrintOutEx method to print two collated copies of the first two pages of the worksheet to the default printer. To run this code example, your workbook must contain a worksheet named Sheet1
with some data.
This example is for a document-level customization.
private void PrintWorksheet()
{
Microsoft.Office.Tools.Excel.Worksheet mySheet = Globals.Sheet1.Base;
mySheet.PrintOutEx(
1,
2,
2,
false,
false,
true,
true);
}
Private Sub PrintWorksheet()
Dim mySheet As Microsoft.Office.Tools.Excel.WorksheetBase = Globals.Sheet1
mySheet.PrintOutEx( _
From:=1, _
To:=2, _
Copies:=2, _
Preview:=False, _
Collate:=True, _
IgnorePrintAreas:=True)
End Sub
Remarks
"Pages" in the descriptions of From
and To
refers to printed pages, not to overall pages in the sheet or workbook.
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.