InstalledPrinters Collection

Publisher Developer Reference

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

Version Information
 Version Added:  Publisher 2007

Remarks

To provide the user 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, as shown in the following example.

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.

Visual Basic for Applications
  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

See Also