ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   detect all printers in networks (https://www.excelbanter.com/excel-programming/381062-detect-all-printers-networks.html)

zz

detect all printers in networks
 
Is it possible to detect all active printers in a network directory?, i need to display them all in a listview control in a userform, this is the first time i'm attempting to do this so i don't know how it could be done.


--
--
---
ZZ [underground]
Semi-musico,cuasi-poeta y loco

zz

detect all printers in networks
 
great!!

easier than i thougth , but i'm not sure i understand it


dissectioning

first: a reference to ("wscript.network"), i'm assuming it is the local
computer's network configuration we're reading here?

second : the EnumPrinterConnections method/function returns an array
containing all the printers connected to 'this' computer, since it only
retrieves the Printers installed on 'this' machine [there are thousands
of printers in the server's directory].

third : you loop trough all items in the array, which are actually
objects? of the type printer?

so, the printer.item( i ) actually retrieves the port to wich printer
is connected/assigned and then the name of the printer would be
printer.item(i+1)?



i wonder if this could be done to read all printers available for install in
the server's directory


thanks a lot.


--
--
---
ZZ [underground]
Semi-musico,cuasi-poeta y loco


"Tom Ogilvy" wrote in message
...
Sub a()
Set WshNetwork = CreateObject("WScript.Network")
' Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 To oPrinters.Count - 1 Step 2
Debug.Print "Port " & oPrinters.Item(i) & " = " & _
oPrinters.Item(i + 1)
Next
End Sub


perhaps.

--
Regards,
Tom Ogilvy


"zz" wrote:

Is it possible to detect all active printers in a network directory?, i
need to display them all in a listview control in a userform, this is the
first time i'm attempting to do this so i don't know how it could be
done.


--
--
---
ZZ [underground]
Semi-musico,cuasi-poeta y loco





All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com