PrintOut Method

Microsoft Word Visual Basic

Prints all or part of the specified document.

expression.PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)

expression    Required. An expression that returns one of the above objects.

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.

wdPrintAllDocument
wdPrintCurrentPage
wdPrintFromTo
wdPrintRangeOfPages
wdPrintSelection

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.

wdPrintAutoTextEntries
wdPrintComments
wdPrintDocumentContent
wdPrintDocumentWithMarkup
wdPrintEnvelope
wdPrintKeyAssignments
wdPrintMarkup
wdPrintProperties
wdPrintStyles

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.

wdPrintAllPages
wdPrintEvenPagesOnly
wdPrintOddPagesOnly

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’ve 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).

ShowPrintOut method as it applies to the Envelope object.

Prints an envelope without adding the envelope to the active document.

expression.PrintOut(ExtractAddress, Address, AutoText, OmitReturnAddress, ReturnAddress, ReturnAutoText, PrintBarCode, PrintFIMA, Size, Height, Width, FeedSource, AddressFromLeft, AddressFromTop, ReturnAddressFromLeft, ReturnAddressFromTop, DefaultFaceUp, DefaultOrientation, PrintEPostage, Vertical, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop)

expression    Required. An expression that returns an Envelope object.

ExtractAddress   Optional Variant. True to use the text marked by the "EnvelopeAddress" bookmark (a user-defined bookmark) as the recipient's address.

Address   Optional Variant. A string that specifies the recipient's address (ignored if ExtractAddress is True).

AutoText   Optional Variant. The name of the AutoText entry that includes a recipient's address.

OmitReturnAddress   Optional Variant. True to omit the return address.

ReturnAddress   Optional Variant. A string that specifies the return address.

ReturnAutoText   Optional Variant. The name of the AutoText entry that includes a return address.

PrintBarCode   Optional Variant. True to add a POSTNET bar code. For U.S. mail only.

PrintFIMA   Optional Variant. True to add a Facing Identification Mark (FIM-A) for use in presorting courtesy reply mail. For U.S. mail only.

Size   Optional Variant. A string that specifies the envelope size. The string should match one of the sizes listed on the left side of the Envelope size box in the Envelope Options dialog box (for example, "Size 10").

Height   Optional Variant. The height of the envelope (in points) when the Size argument is set to "Custom size."

Width   Optional Variant. The width of the envelope (in points) when the Size argument is set to "Custom size."

FeedSource   Optional Variant. True to use the FeedSource property of the Envelope object to specify which paper tray to use when printing the envelope.

AddressFromLeft   Optional Variant. The distance (in points) between the left edge of the envelope and the recipient's address.

AddressFromTop   Optional Variant. The distance (in points) between the top edge of the envelope and the recipient's address.

ReturnAddressFromLeft   Optional Variant. The distance (in points) between the left edge of the envelope and the return address.

ReturnAddressFromTop   Optional Variant. The distance (in points) between the top edge of the envelope and the return address.

DefaultFaceUp   Optional Variant. True to print the envelope face up; False to print it face down.

DefaultOrientation   Optional Variant. The orientation of the envelope. Can be any WdEnvelopeOrientation constant.

wdLeftPortrait
wdCenterPortrait
wdRightPortrait
wdLeftLandscape
wdCenterLandscape
wdRightLandscape
wdLeftClockwise
wdCenterClockwise
wdRightClockwise

PrintEPostage   Optional Variant. True to print postage using an Internet e-postage vendor.

Vertical   Optional Variant. True prints text vertically on the envelope. Used for Asian-language envelopes.

RecipientNamefromLeft   Optional Variant. The position of the recipient's name, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.

RecipientNamefromTop   Optional Variant. The position of the recipient's name, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.

RecipientPostalfromLeft   Optional Variant. The position of the recipient's postal code, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.

RecipientPostalfromTop   Optional Variant. The position of the recipient's postal code, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.

SenderNamefromLeft   Optional Variant. The position of the sender's name, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.

SenderNamefromTop   Optional Variant. The position of the sender's name, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.

SenderPostalfromLeft   Optional Variant. The position of the sender's postal code, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.

SenderPostalfromTop   Optional Variant. The position of the sender's postal code, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.

ShowPrintOut method as it applies to the MailingLabel object.

Prints a label or a page of labels with the same address.

expression.PrintOut(Name, Address, ExtractAddress, LaserTray, SingleLabel, Row, Column, PrintEPostageLabel, Vertical)

expression    Required. An expression that returns a MailingLabel object.

Name   Optional Variant. The mailing label name.

Address   Optional Variant. The text for the label address.

ExtractAddress   Optional Variant. True to use the text marked by the "EnvelopeAddress" bookmark (a user-defined bookmark) as the label text. If this argument is specified, Address and AutoText are ignored.

LaserTray   Optional Variant. The laser printer tray to be used. Can be any WdPaperTray constant.

wdPrinterAutomaticSheetFeed
wdPrinterDefaultBin
wdPrinterEnvelopeFeed
wdPrinterFormSource
wdPrinterLargeCapacityBin
wdPrinterLargeFormatBin
wdPrinterLowerBin
wdPrinterManualEnvelopeFeed
wdPrinterManualFeed
wdPrinterMiddleBin
wdPrinterOnlyBin
wdPrinterPaperCassette
wdPrinterSmallFormatBin
wdPrinterTractorFeed
wdPrinterUpperBin

SingleLabel   Optional Variant. True to print a single label; False to print an entire page of the same label.

Row   Optional Variant. The label row for a single label. Not valid if SingleLabel is False.

Column   Optional Variant. The label column for a single label. Not valid if SingleLabel is False.

PrintEPostageLabel   Optional Variant. True to print postage using an Internet e-postage vendor.

Vertical   Optional Variant. True prints text vertically on the label. Used for Asian-language mailing labels.

Example

ShowAs it applies to the Application, Document, and Window objects.

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)
				

ShowAs it applies to the Envelope object.

This example prints an envelope using the user address as the return address and a predefined recipient address.

recep = "Don Funk" & vbCr & "123 Skye St." & vbCr & _
    "OurTown, WA 98107"
ActiveDocument.Envelope.PrintOut Address:=recep, _
    ReturnAddress:=Application.UserAddress, _
    Size:="Size 10", PrintBarCode:=True
				

ShowAs it applies to the MailingLabel object.

This example prints a page of Avery 5664 mailing labels, using the specified address.

addr = "Jane Doe" & vbCr & "123 Skye St." _
    & vbCr & "OurTown, WA 98107"
Application.MailingLabel.PrintOut Name:="5664", Address:=addr