Word) (Application.PrintOut 方法

列印全部或部分指定的文件。

語法

運算式PrintOut (BackgroundAppendRangeOutputFileNameFromToItemCopiesPagesPageTypePrintToFileCollateFileNameActivePrinterMacGXManualDuplexPrintPrintZoomColumnPrintZoomRowPrintZoomPaperWidthPrintZoomPaperHeight)

需要 expression。 代表 Application 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Background 選用 Variant 若要讓 Microsoft Word 列印文件時繼續執行巨集設定為 True
Append 選用 Variant 若要將指定的文件附加到 OutputFileName 引數所指定的檔案名稱設定為 TrueFalse 覆寫 OutputFileName 的內容。
Range 選用 Variant ] 頁面上的範圍。 可以是任何 WdPrintOutRange 常數。
OutputFileName 選用 Variant 如果 PrintToFile 是 True ,則此引數會指定輸出檔案的路徑和檔案名稱。
From 選用 Variant 起始頁碼當 Range 設定為 wdPrintFromTo 時。
To 選用 Variant 結束頁碼當 Range 設定為 wdPrintFromTo 時。
Item 選用 Variant 要列印的項目。 可以是任何 WdPrintOutItem 常數。
Copies 選用 Variant 要列印的份數。
Pages 選用 Variant 要列印的頁碼和頁面範圍,以逗號隔開。 例如,"2, 6-10" 會就列印第 2 頁及第 6 至第 10 頁。
PageType 選用 Variant 要列印頁面的類型。 可以是任何 WdPrintOutPages 常數。
PrintToFile 選用 Variant True 是表示 印表機指示傳送至檔案。 請務必使用 OutputFileName 指定的檔案名稱。
Collate 選用 Variant 當列印多個會複製文件、 True 列印下一份前,先列印文件的所有頁面。
FileName 選用 Variant 要列印文件的路徑和檔案名稱。 如果省略此引數,則 Word 會列印使用中文件。 (適用僅搭配 Application 物件)。
ActivePrinterMacGX 選用 Variant 這個引數只能在 Microsoft Office Macintosh Edition 中使用。 如需這個引數的詳細資訊,請參考包含在 Microsoft Office Macintosh Edition 中的語言參照說明。
ManualDuplexPrint 選用 Variant True 是表示 上沒有雙面列印套件 的印表機列印雙面文件。 如果此引數 ,則為 TruePrintBackgroundPrintReverse 屬性被忽略。 使用 PrintOddPagesInAscendingOrderPrintEvenPagesInAscendingOrder 屬性來控制在手動雙面列印輸出。 此引數可能無法使用時,根據您所選取或安裝的語言支援 (例如 US English)。
PrintZoomColumn 選用 Variant 您想要 Word 在單一頁面上水平排列的頁數。 它可以是 1、2、3 或 4。 請搭配 PrintZoomRow 引數使用,以便在單一紙張上列印多重頁面。
PrintZoomRow 選用 Variant 您想要 Word 在單一頁面上垂直排列的頁數。 它可以是 1、2 或 4。 請搭配 PrintZoomColumn 引數使用,以便在單一紙張上列印多重頁面。
PrintZoomPaperWidth 選用 Variant 您要 Word 調整列印頁面的寬度,以 twip 為單位 (20 twip = 1 點;72 點 = 1 英吋) 。
PrintZoomPaperHeight 選用 Variant 您希望 Word 調整列印頁面的高度,以 twip 為單位 (20 twip = 1 點;72 點 = 1 英吋) 。

範例

這則範例會列印使用中文件的目前頁面。

ActiveDocument.PrintOut Range:=wdPrintCurrentPage

這則範例會列印目前資料夾中的所有文件。 Dir 函數是用來傳回具有副檔名 ".doc" 的所有檔案名稱。

adoc = Dir("*.DOC") 
Do While adoc <> "" 
 Application.PrintOut FileName:=adoc 
 adoc = Dir() 
Loop

這則範例會列印使用中視窗內文件的前三頁。

ActiveDocument.ActiveWindow.PrintOut _ 
 Range:=wdPrintFromTo, From:="1", To:="3"

這則範例會列印使用中文件內的註解。

If ActiveDocument.Comments.Count >= 1 Then 
 ActiveDocument.PrintOut Item:=wdPrintComments 
End If

這則範例會列印使用中文件,並在每一個紙張上排列六個頁面。

ActiveDocument.PrintOut PrintZoomColumn:=3, _ 
 PrintZoomRow:=2

這則範例會以實際大小的 75% 來列印使用中文件。

ActiveDocument.PrintOut _ 
 PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _ 
 PrintZoomPaperHeight:=0.75 * (11 * 1440)

另請參閱

Application 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應