Hello,
How can I list the printers installed on the computer in a listbox?
The following code I got from here a while ago (thanks!) list them in a message box, but I need the user to be able to select one to save it in a table. The listbox is called lstListPrinters and the table tblPrinterSelection
How can I list the printers installed on the computer in a listbox?
The following code I got from here a while ago (thanks!) list them in a message box, but I need the user to be able to select one to save it in a table. The listbox is called lstListPrinters and the table tblPrinterSelection
Code:
If Printers.Count > 0 Then
' Get count of installed printers.
strMsg = "Printers installed: " & Printers.Count & vbCrLf & vbCrLf
' Enumerate printer system properties.
For Each prtLoop In Application.Printers
With prtLoop
strMsg = strMsg _
& "Device name: " & .DeviceName & vbCrLf _
& "Driver name: " & .DriverName & vbCrLf _
& "Port: " & .Port & vbCrLf & vbCrLf
End With
Next prtLoop
Else
strMsg = "No printers are installed."
End If