Printers Collection

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Application
Aa156386.parchild(en-us,office.10).gifPrinters
Aa156386.space(en-us,office.10).gifAa156386.parchild(en-us,office.10).gifPrinter

The Printers collection contains Printer objects representing all the printers available on the current system.

Using the Printers collection

Use the Printers property of the Application object to return the Printers collection. You can enumerate through the Printers collection by using the For Each...Next statement. The following example displays information about all the printers available to the system.

`

Dim prtLoop As Printer

For Each prtLoop In Application.Printers With prtLoop MsgBox "Device name: " & .DeviceName & vbCr _ & "Driver name: " & .DriverName & vbCr _ & "Port: " & .Port End With Next prtLoop

`

You can refer to an individual Printer object in the Printers collection either by referring to the printer by name, or by referring to its index within the collection.

The Printers collection is indexed beginning with zero. If you refer to a printer by its index, the first printer is Printers(0), the second printer is Printers(1), and so on.

You can't add or delete a Printer object from the Printers collection.