NamedRange.PrintOutEx Method

Definition

Prints the object.

public object PrintOutEx (object From, object To, object Copies, object Preview, object ActivePrinter, object PrintToFile, object Collate, object PrToFileName);
abstract member PrintOutEx : obj * obj * obj * obj * obj * obj * obj * obj -> obj
Public Function 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) As Object

Parameters

From
Object

The number of the first page to start printing. By default, printing starts at the beginning.

To
Object

The number of the last page to print. By default, printing ends at the last page.

Copies
Object

The number of copies to print. By default, one copy is printed.

Preview
Object

true to have Excel invoke print preview before printing the object. false (or omitted) 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.

Returns

An Object that represents a NamedRange object.

Examples

The following code example uses the PrintOutEx method to print one copy of the first two pages of the named range NamedRange1 to the default printer. To run this code example, your workbook must contain a worksheet named Sheet1 with a named range named NamedRange1 that covers a range of cells that contain some data.

This example is for a document-level customization.

private void PrintNamedRange()
{
    Microsoft.Office.Tools.Excel.NamedRange myNamedRange =
        Globals.Sheet1.namedRange1;

    myNamedRange.PrintOutEx(
        1,
        2,
        1,
        false,
        
        false,
        true);
}
Private Sub PrintNamedRange()
    Dim myNamedRange As Microsoft.Office.Tools.Excel.NamedRange = _
        Globals.Sheet1.NamedRange1

    myNamedRange.PrintOutEx( _
        From:=1, _
        To:=2, _
        Copies:=1, _
        Preview:=False)            
End Sub

Applies to