Printing


List of Installed Printers

There does not seem to be a way to access the list of installed printers from VBA
This currently requires API calls.


Changing the Selected Printer

Returns or sets the name of the active printer

Application.ActivePrinter 


Sending the Document to the Printer


Call ActiveDocument.PrintOut(Background:=True, _ 
                             Range:= wdPrintOutRange.wdPrintAllDocument
                             Append:=False, _
                             OutputFileName:="", _
                             From:="1", _
                             To:="3", _
                             Item:=wdPrintOutItem.wdPrintDocumentContent
                             Copies:=1, _
                             Pages:="1,3,5-6"
                             PageType:=wdPrintOutPages.wdPrintOddPagesOnly
                             PrintToFile:=False, _
                             Collate:=True, _
                             FileName:="", _
                             PrintZoomColumn:=0, _
                             PrintZoomRow:=0, _
                             PrintZoomPaperWidth:=0, _
                             PrintZoomPaperHeight:=0)

Background - Variant. Set to True to have the macro continue while Microsoft Word prints the document.
Range - Variant. The page range. Can be any WdPrintOutRange constant.
Append - 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.
OutputFileName - Variant. If PrintToFile is True, this argument specifies the path and file name of the output file.
From - Variant. The starting page number when Range is set to wdPrintFromTo.
To - Variant. The ending page number when Range is set to wdPrintFromTo.
Item - Variant. The item to be printed. Can be any WdPrintOutItem constant.
Copies - Variant. The number of copies to be printed.
Pages - 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 - Variant. The type of pages to be printed. Can be any WdPrintOutPages constant.
PrintToFile - Variant. True to send printer instructions to a file. Make sure to specify a file name with OutputFileName.
Collate - Variant. When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileName - 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 - 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 - 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 - Variant. (Added in 2000). 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 - Variant. (Added in 2000). 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 - Variant. (Added in 2000) .The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeight - Variant. (Added in 2000). The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).



Returns or sets the default tray your printer uses to print documents.

Application.Options.DefaultTrayID = wdPaperTray.wdPrinterUpperBin 



This changes the view of the active document to print preview

Application.PrintPreview = True 

If Application.PrintPreview = True Then 
End If


ActiveDocument.Repaginate 




© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev