Printer object (Publisher)
A Printer object represents a printer installed on your computer.
Remarks
Many of the properties of the Printer object, such as PaperSize, PaperSource, and PaperOrientation, correspond to the settings in the Print Setup dialog box (File menu) in the Microsoft Publisher user interface.
The collection of all the printers installed on your computer is represented by the InstalledPrinters collection.
Example
The following Microsoft Visual Basic for Applications (VBA) macro shows how you can use the PrinterName and IsActivePrinter properties of the Printer object to get a list of all the installed printers on the computer, determine which of them is currently the active printer, and get some of the settings of the active printer. The macro displays the results in the Immediate window.
Public Sub Printer_Example()
Dim pubInstalledPrinters As Publisher.InstalledPrinters
Dim pubApplication As Publisher.Application
Dim pubPrinter As Publisher.Printer
Set pubApplication = ThisDocument.Application
Set pubInstalledPrinters = pubApplication.InstalledPrinters
For Each pubPrinter In pubInstalledPrinters
Debug.Print pubPrinter.PrinterName
If pubPrinter.IsActivePrinter Then
Debug.Print "This is the active printer"
Debug.Print "Paper size is ", pubPrinter.PaperSize
Debug.Print "Paper orientation is ", pubPrinter.PaperOrientation
Debug.Print "Paper source is ", pubPrinter.PaperSource
End If
Next
End Sub
Properties
- Application
- DriverType
- Index
- IsActivePrinter
- IsColor
- IsDuplex
- PaperHeight
- PaperOrientation
- PaperSize
- PaperSource
- PaperWidth
- Parent
- PrintableRect
- PrinterName
- PrintMode
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.