ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listing ActivePrinters (https://www.excelbanter.com/excel-programming/306458-listing-activeprinters.html)

Exceller

Listing ActivePrinters
 
Hi all,

Is there a way to list all the active printers for the application?

Tom Ogilvy

Listing ActivePrinters
 
http://groups.google.com/groups?selm...&output=gplain


Not sure why you can't popup the built in printer selection dialog.

Sub TestDialog()
Application.Dialogs(xlDialogPrinterSetup).Show
End Sub


But here is some information:

http://support.microsoft.com/?id=166008
ACC: Enumerating Local and Network Printers

Athough the above article is for Access, the code works in Excel as well.

Enumerating Windows' Available Ports
http://www.mvps.org/vbnet/code/enums/enumports.htm
=======================


This posting by Jim Rech may be useful as well - certainly simpler:

========< J Rech Post =======
From: "Jim Rech"
Subject: Setting active printers will Excel 97 VBA
Date: Thu, 19 Oct 2000 14:04:56 -0400
Lines: 9
Newsgroups: microsoft.public.excel.programming

This macro enumerates printers and their connections. Parsing it you may be
able to construct the syntax ActivePrinter wants:

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


--
Jim Rech
Excel MVP

=========< J Rech Post =====

--
Regards,
Tom Ogilvy
"exceller" wrote in message
...
Hi all,

Is there a way to list all the active printers for the application?





All times are GMT +1. The time now is 10:02 AM.

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