Document.PrintOut 方法 (Word)Document.PrintOut method (Word)
06/08/2017
本文内容
打印全部或部分指定文档。Prints all or part of the specified document.
语法Syntax
表达式。PrintOut (背景、 Append、 Range、 OutputFileName、 From、 To、 Item、副本、 Pages、 PageType、 PrintToFile、 Collate、 FileName、 ActivePrinterMacGX、 ManualDuplexPrint、 PrintZoomColumn、 PrintZoomRow、 PrintZoomPaperWidth、PrintZoomPaperHeight )expression.PrintOut (Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)
expression 是必需的。expression Required. 一个代表A variable that represents a
参数Parameters
名称Name
必需/可选Required/Optional
数据类型Data type
说明Description
BackgroundBackground
可选Optional
VariantVariant
如果将该属性设置为 True ,则 Microsoft Word 在打印文档时继续运行宏。Set to True to have the macro continue while Microsoft Word prints the document.
AppendAppend
可选Optional
VariantVariant
设置为 True 以将指定文档追加到 OutputFileName 参数指定的文件名。Set to True to append the specified document to the file name specified by the OutputFileName argument. 设置为 False 以覆盖 OutputFileName 的内容。False to overwrite the contents of OutputFileName.
RangeRange
可选Optional
VariantVariant
页面范围。The page range. 可以是任何 WdPrintOutRange 常量。Can be any WdPrintOutRange constant.
OutputFileNameOutputFileName
可选Optional
VariantVariant
如果当为 True 时,此参数将指定输出文件的路径和文件名称。If PrintToFile is True, this argument specifies the path and file name of the output file.
FromFrom
可选Optional
VariantVariant
如果将 Range 设置为 wdPrintFromTo ,则该参数指定起始页码。The starting page number when Range is set to wdPrintFromTo.
ToTo
可选Optional
VariantVariant
如果将 Range 设置为 wdPrintFromTo ,则该参数指定结束页码。The ending page number when Range is set to wdPrintFromTo.
ItemItem
可选Optional
VariantVariant
要打印的项目。The item to be printed. 可以是任何 WdPrintOutItem 常量。Can be any WdPrintOutItem constant.
CopiesCopies
可选Optional
VariantVariant
要打印的份数。The number of copies to be printed.
PagesPages
可选Optional
VariantVariant
要打印的页码和页码范围,中间用逗号分开。The page numbers and page ranges to be printed, separated by commas. 例如,"2, 6-10"表示打印第 2 页以及第 6 至第 10 页。For example, "2, 6-10" prints page 2 and pages 6 through 10.
PageTypePageType
可选Optional
VariantVariant
要打印的页面类型。The type of pages to be printed. 可以是任何 WdPrintOutPages 常量。Can be any WdPrintOutPages constant.
PrintToFilePrintToFile
可选Optional
VariantVariant
真 要发送打印机说明文件。True to send printer instructions to a file. 请确保指定的文件名称与 OutputFileName。Make sure to specify a file name with OutputFileName.
CollateCollate
可选Optional
VariantVariant
在打印文档的多份副本时,如果该属性值为 True ,则完成打印所有页面后再打印下一份副本。When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileNameFileName
可选Optional
VariantVariant
要打印的文档的路径和文件名称。The path and file name of the document to be printed. 如果省略此参数,Word 将打印活动文档。If this argument is omitted, Word prints the active document. (只与该 应用程序 对象的可用)。(Available only with the Application object.)
ActivePrinterMacGXActivePrinterMacGX
可选Optional
VariantVariant
该参数仅适用于 Microsoft Office Macintosh Edition。This argument is available only in Microsoft Office Macintosh Edition. 有关该参数的其他信息,请参阅 Microsoft Office Macintosh Edition 附带的语言参考帮助。For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.
ManualDuplexPrintManualDuplexPrint
可选Optional
VariantVariant
真 要在无双面打印组件的打印机上打印双面文档。True to print a two-sided document on a printer without a duplex printing kit. 如果该参数为 True , PrintBackground 和 PrintReverse 属性将被忽略。If this argument is True, the PrintBackground and PrintReverse properties are ignored. PrintOddPagesInAscendingOrder 和 PrintEvenPagesInAscendingOrder 属性用于控制在手动双面打印输出。Use the PrintOddPagesInAscendingOrder and PrintEvenPagesInAscendingOrder properties to control the output during manual duplex printing. 此参数可能不可用,这取决于您所选择或安装的语言支持 (例如美国英语)。This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
PrintZoomColumnPrintZoomColumn
可选Optional
VariantVariant
表示 Word 在一页纸上水平放置的页数。The number of pages you want Word to fit horizontally on one page. 可以是 1、2、3 或 4 页。Can be 1, 2, 3, or 4. 与 PrintZoomRow 参数一同使用可在单张纸上打印多页文档。Use with the PrintZoomRow argument to print multiple pages on a single sheet.
PrintZoomRowPrintZoomRow
可选Optional
VariantVariant
表示 Word 在一页纸上垂直放置的页数。The number of pages you want Word to fit vertically on one page. 可以是 1、2 或 4 页。Can be 1, 2, or 4. 与 PrintZoomColumn 参数一同使用可在单张纸上打印多页文档。Use with the PrintZoomColumn argument to print multiple pages on a single sheet.
PrintZoomPaperWidthPrintZoomPaperWidth
可选Optional
VariantVariant
Word 将打印页面缩放到的宽度,以缇为单位(20 缇 = 1 磅;72 磅 = 1 英寸)。The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeightPrintZoomPaperHeight
可选Optional
VariantVariant
Word 将打印页面缩放到的高度,以缇为单位(20 缇 = 1 磅;72 磅 = 1 英寸)。The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
示例Example
本示例打印活动文档的当前页面。This example prints the current page of the active document.
ActiveDocument.PrintOut Range:=wdPrintCurrentPage
本示例打印当前文件夹中的所有文档。This example prints all the documents in the current folder. Dir 函数用于返回所有扩展名为".doc"的文件名。The Dir function is used to return all file names that have the file name extension ".doc".
adoc = Dir("*.DOC")
Do While adoc <> ""
Application.PrintOut FileName:=adoc
adoc = Dir()
Loop
本示例打印活动窗口中文档的前三页。This example prints the first three pages of the document in the active window.
ActiveDocument.ActiveWindow.PrintOut _
Range:=wdPrintFromTo, From:="1", To:="3"
本示例打印活动文档中的备注。This example prints the comments in the active document.
If ActiveDocument.Comments.Count >= 1 Then
ActiveDocument.PrintOut Item:=wdPrintComments
End If
本示例将打印活动文档,每张纸上打印六页文档。This example prints the active document, fitting six pages on each sheet.
ActiveDocument.PrintOut PrintZoomColumn:=3, _
PrintZoomRow:=2
本示例按实际尺寸的 75% 打印活动文档。This example prints the active document at 75% of actual size.
ActiveDocument.PrintOut _
PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _
PrintZoomPaperHeight:=0.75 * (11 * 1440)
另请参阅See also
支持和反馈Support and feedback
有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.