Link to home
Start Free TrialLog in
Avatar of Ryali
Ryali

asked on

Detecting a Printer through VB code

To detect whether a printer is installed in the network i have writen the below code.

Dim oInstalledPrinter       As VB.Printer

For Each oInstalledPrinter In VB.Printers
      mblnPrinterExists = True
      Exit For
Next ' oInstalledPrinter



But with this code even FAX machine is also accepted as printer.
Can any one help me out
Avatar of Ryali
Ryali

ASKER

none
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Check each printer's driver name:

If Printer.DriverName = sEmpty Then
   MsgBox "Driver for printer is missing.", vbExclamation
   Exit Sub
End If
Avatar of Ryali

ASKER

Theoretically good but practically average solution. We should write a method to capture the list of printers.