Compartir a través de


Printers Collection

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

Remarks

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.

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.

Example

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

See Also

Concepts

Printers Object Members

Access Object Model Reference