Listing ActivePrinters

T

Tom Ogilvy

http://groups.google.com/groups?selm=#lRIKT0qBHA.2516@tkmsftngp03&oe=UTF-8&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" <[email protected]>
Subject: Re: 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
 
Top