Application.PrintOut method (Word)
Prints all or part of the specified document.
Syntax
expression.PrintOut (Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)
expression Required. A variable that represents an Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Background | Optional | Variant | Set to True to have the macro continue while Microsoft Word prints the document. |
Append | Optional | Variant | Set to True to append the specified document to the file name specified by the OutputFileName argument. False to overwrite the contents of OutputFileName. |
Range | Optional | Variant | The page range. Can be any WdPrintOutRange constant. |
OutputFileName | Optional | Variant | If PrintToFile is True, this argument specifies the path and file name of the output file. |
From | Optional | Variant | The starting page number when Range is set to wdPrintFromTo. |
To | Optional | Variant | The ending page number when Range is set to wdPrintFromTo. |
Item | Optional | Variant | The item to be printed. Can be any WdPrintOutItem constant. |
Copies | Optional | Variant | The number of copies to be printed. |
Pages | Optional | Variant | The page numbers and page ranges to be printed, separated by commas. For example, "2, 6-10" prints page 2 and pages 6 through 10. |
PageType | Optional | Variant | The type of pages to be printed. Can be any WdPrintOutPages constant. |
PrintToFile | Optional | Variant | True to send printer instructions to a file. Make sure to specify a file name with OutputFileName. |
Collate | Optional | Variant | When printing multiple copies of a document, True to print all pages of the document before printing the next copy. |
FileName | Optional | Variant | The path and file name of the document to be printed. If this argument is omitted, Word prints the active document. (Available only with the Application object.) |
ActivePrinterMacGX | Optional | Variant | This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition. |
ManualDuplexPrint | Optional | Variant | True to print a two-sided document on a printer without a duplex printing kit. If this argument is True, the PrintBackground and PrintReverse properties are ignored. 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. |
PrintZoomColumn | Optional | Variant | The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet. |
PrintZoomRow | Optional | Variant | The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet. |
PrintZoomPaperWidth | Optional | Variant | The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch). |
PrintZoomPaperHeight | Optional | Variant | 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. 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
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
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기