Document.PrintOut method (Visio)
Prints the contents of the active document and provides various printing options.
Syntax
expression.PrintOut (PrintRange, FromPage, ToPage, ScaleCurrentViewToPaper, PrinterName, PrintToFile, OutputFileName, Copies, Collate, ColorAsBlack)
expression A variable that represents a Document object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
PrintRange | Required | VisPrintOutRange | The range of document pages to be printed. See Remarks for possible values. |
FromPage | Optional | Long | If PrintRange is visPrintFromTo, the first page in the range to be printed. The default is 1, which indicates the first page of the drawing. |
ToPage | Optional | Long | If PrintRange is visPrintFromTo, the last page in the range to be printed. The default is -1, which indicates the last page of the drawing. |
ScaleCurrentViewToPaper | Optional | Boolean | If PrintRange is visPrintCurrentView, True to scale the part of the drawing that fits in the program window to fit on the current default paper size; False to print on as many printer pages as necessary. The default is False. |
PrinterName | Optional | String | The name of the printer to use. The default is the printer currently selected in Visio. |
PrintToFile | Optional | Boolean | True to send the information for printing to a file on a disk, rather than to the printer; False to print to the printer. The default is False. If you specify True for PrintToFile but don't pass a valid value for OutputFileName, the drawing is sent to the active printer. |
OutputFileName | Optional | String | If PrintToFile is True, the name and path of the .prn file to which to print, enclosed in quotation marks. |
Copies | Optional | Long | The number of copies to be printed. The default is one copy. |
Collate | Optional | Boolean | True to collate copies. False to not collate. The default is False. |
ColorAsBlack | Optional | Boolean | True to print all colors as black to ensure that all shapes are visible in the printed drawing. This is useful if a monochrome printer translates very light colors in a drawing to white rather than a shade of gray. False to print colors normally. The default is False. |
Return value
Nothing
Remarks
Calling the PrintOut method is the equivalent of selecting print options in the Print dialog box (click the File tab, click Print, and then click Print again), and then clicking OK.
Possible values for PrintRange are shown in the following table and declared in VisPrintOutRange in the Visio type library.
Constant | Value | Description |
---|---|---|
visPrintAll | 0 | Prints all foreground pages. |
visPrintCurrentPage | 2 | Prints the active page. |
visPrintCurrentView | 4 | Prints the current view area. |
visPrintFromTo | 1 | Prints pages between the FromPage value and the ToPage value. |
visPrintSelection | 3 | Prints a selection. |
Example
This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PrintOut method to print two copies of the current page to the active printer.
Public Sub PrintOut_Example()
'Print two copies of the current page to the default printer
ThisDocument.PrintOut visPrintCurrentPage, , , , , , , 2
End Sub
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.