Macro to list all Printers on a network

Excel2006

Active Member
Joined
Dec 19, 2006
Messages
455
Hi

Someone wrote the macro below to show all printers that a user is connected to. I modified it so that it shows the info in an excel sheet.
IT shows the printer name.
What would I need to change in the Macro to list all Printers on a particular Windows network, whether I am connected to them or not?


Sub PrintersOnNetwork()

'Check which Printers u r connected to, msgbox

Set WshNetwork = CreateObject("WScript.Network")
Set objPrinters = WshNetwork.EnumPrinterConnections
PrinterStr = "Printers:" & Chr(13)
For i = 0 To objPrinters.Count - 1 Step 2
PrinterStr = PrinterStr & "Printer " & objPrinters.Item(i) & " = " & objPrinters.Item(i + 1) & Chr(13)

Sheets("PrinterList").Activate
Cells(i + 1, 1).Value = "Printer " & objPrinters.Item(i) & " = " & objPrinters.Item(i + 1) & Chr(13)

Next

Columns(1).AutoFit


End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,169
Office Version
  1. 2013
Platform
  1. Windows
Id really like to know the answer to this also :biggrin:
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,101
Messages
5,768,101
Members
425,453
Latest member
bince

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top