Word 開發人員參考資料
Application.PrintOut 方法
列印全部或部分指定的文件。
語法
運算式.PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)
運算式 必要。代表 Application 物件的變數。
參數
名稱 必要/選用 資料類型 描述
Background 選用 Variant 設定為 True,可讓巨集在 Microsoft Word 列印文件時繼續執行。
Append 選用 Variant 設定為 True,可將指定的文件附加至 OutputFileName 引數指定的檔案名稱。False 則是覆寫 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 是表示在沒有雙面列印套件的印表機上列印雙面文件。如果這個引數為 True,就會略過 PrintBackground 和 PrintReverse 屬性。請使用 PrintOddPagesInAscendingOrder 和 PrintEvenPagesInAscendingOrder 屬性來控制手動雙面列印期間的輸出。此引數對您而言可能無效;有效與否,須視您所選取或安裝的語言支援 (例如:美式英文) 而定。
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 英吋)。
範例
這則範例會列印使用中文件的目前頁面。
[Visual Basic for Applications]
ActiveDocument.PrintOut Range:=wdPrintCurrentPage
這則範例會列印目前資料夾中的所有文件。Dir 函數是用來傳回具有副檔名 ".doc" 的所有檔案名稱。
[Visual Basic for Applications]
adoc = Dir("*.DOC")
Do While adoc <> ""
Application.PrintOut FileName:=adoc
adoc = Dir()
Loop
這則範例會列印使用中視窗內文件的前三頁。
[Visual Basic for Applications]
ActiveDocument.ActiveWindow.PrintOut _
Range:=wdPrintFromTo, From:="1", To:="3"
這則範例會列印使用中文件內的註解。
[Visual Basic for Applications]
If ActiveDocument.Comments.Count >= 1 Then
ActiveDocument.PrintOut Item:=wdPrintComments
End If
這則範例會列印使用中文件,並在每一個紙張上排列六個頁面。
[Visual Basic for Applications]
ActiveDocument.PrintOut PrintZoomColumn:=3, _
PrintZoomRow:=2
這則範例會以實際大小的 75% 來列印使用中文件。
[Visual Basic for Applications]
ActiveDocument.PrintOut _
PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _
PrintZoomPaperHeight:=0.75 * (11 * 1440)
© 2006 Microsoft Corporation. All rights reserved.