InstalledPrinters object (Publisher)

Represents the collection of all Printer objects, each of which represents one of the printers installed on the computer.

Remarks

To provide the user with a choice of printers to print a publication, you can iterate through the InstalledPrinters collection to get a list of the names of all the printers installed on the computer.

The default property of the InstalledPrinters collection is Item.

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 and to determine which of them is currently the active printer.

Public Sub InstalledPrinters_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." 
 End If 
 Next 
 
End Sub 

Properties

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.