I need to find out if a printer is currently accessible on a network.
I tried the following code but all printers showed "Not Available" even though two were (local)
MSDN uses a printer name like "\\server\print1"
in its "example".
What am I doing wrong?
For Each Pr In Printers
Dim wshNet As Object
Set wshNet = CreateObject("Wscript.Network")
On Error Resume Next
wshNet.AddPrinterConnection "LPT1:", Pr.DeviceName
If Err Then
MsgBox "The printer " & Pr.DeviceName & " is not available"
Else
MsgBox "The printer " & Pr.DeviceName & " is available for printing"
End If
Set wshNet = Nothing
Next
:)
