NamedRange.PrintOutEx 方法

定義

列印物件。

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

參數

From
Object

要開始列印之第一頁的頁碼。 根據預設,會從頭開始列印。

To
Object

要列印之最後一頁的頁碼。 根據預設,會列印直到最後一頁。

Copies
Object

要列印的份數。 根據預設,只會列印一份。

Preview
Object

true 表示會讓 Excel 在列印物件之前叫用預覽列印。 false (或省略) 則表示會立即列印物件。

ActivePrinter
Object

設定使用中印表機的名稱。

PrintToFile
Object

true 可列印至檔案。 如果未指定 PrToFileName,Excel 會提示使用者輸入輸出檔的名稱。

Collate
Object

true 可將多個複本自動分頁。

PrToFileName
Object

如果 PrintToFile 設定為 true,這個引數指定您要列印至其中之檔案的名稱。

傳回

Object,表示 NamedRange 物件。

範例

下列程式代碼範例會使用 方法, PrintOutEx 將具名範圍 NamedRange1 前兩頁的一份複本列印到預設列印機。 若要執行此程式碼範例,您的活頁簿必須包含名為 的工作表,其中包含名為的Sheet1NamedRange1具名範圍,其中包含一些數據的單元格範圍。

此範例適用於檔層級自定義。

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

適用於