Find printer in network

hafco

Registered User.
Local time
Yesterday, 21:00
Joined
Aug 2, 2015
Messages
12
Hello,

I have a question
I am trying to find a network printer by using a function and wia object.
On a local PC this function works just fine but on a network it doesnt.
Does anyone know how to fix this?
This is my code
Code:
Function SelectDevice()

  Dim DevMgr As WIA.DeviceManager
  Dim DevInfo As WIA.DeviceInfo
  Dim dev As WIA.Device
  Dim i As Integer
  
  Set DevMgr = New WIA.DeviceManager
  
  For i = 1 To DevMgr.DeviceInfos().Count
    If MsgBox("Kies printer", vbQuestion + vbYesNo, "Beschikbare WIA apparaten") = vbYes Then
'update table field
        DoCmd.RunSQL ("UPDATE tblClsSettings SET Waarde='" & CStr(DevMgr.DeviceInfos(i).Properties("Name")) & "' WHERE Id = 4")
    End If
  Next i
  
  Set dev = Nothing
  Set DevInfo = Nothing
  Set DevMgr = Nothing
End Function
 

Users who are viewing this thread

Back
Top Bottom