ACTIVEPRINTER VBA PDF

Recently I wanted to change Excel’s ActivePrinter using VBA. That isn’t as straightforward as I expected it to be. In particular there is a. There’s a property of the Application object called ActivePrinter. Add a new VBA Module to workbook and paste the code below into it. Is there a way of creating a list of Active Printers on a users computer for the user to select to be used in the PrintOut method i.e. I am bypassing.

Author: Vibar Nikoshakar
Country: Bulgaria
Language: English (Spanish)
Genre: Education
Published (Last): 6 February 2017
Pages: 72
PDF File Size: 9.6 Mb
ePub File Size: 4.57 Mb
ISBN: 374-8-88477-594-7
Downloads: 29251
Price: Free* [*Free Regsitration Required]
Uploader: Kajigal

In particular there is a localization issue. At startup Excel will set Application.

ActivePrinter to your default printer, in my case usually a Laserjet. I expected that this would do it:.

Excel not only wants to know the printer name but also the port name of the printer, which can be activrprinter like Ne01, LPT1, Nul or any IP address. I almost decided to hard code the string for the above mentioned languages when I realized that the solution is already there.

  BOSKA KOMEDIA DANTEGO PIEKO PDF

ActivePrinter Property

Activeprinter in Word en Powerpoint. Thank you Fran Bus. Just what I was looking for. I have 32 bit Windows API code that gets the device names and works well locally, but needs sctiveprinter work for network printers.

Error in line: Solved that my problem — added the line ThisWorkbook.

So your code not such universal. Thanks for the suggestion, it works ok on my pc, but unfortunately I am having a couple of problems. Does it need a particular library? I could not find any difference with my pc, actievprinter there is no such problem. I expected that this would do it: The problem I typed? ActivePrinter in the immediate window and got as reply: How to get the port of a printer? Configure the printer ports in Windows. And do that on all machines of all users? Sounds a little bit better.

Printer property (Excel) | Microsoft Docs

Unfortunately it is not obvious to create a list of all possible port names. Dialogs xlDialogPrinterSetup and ask the user activeptinter select the printer. Use API functions to retrieve all your installed printers and there port names from the registry. This is the code to test the function: Print “No match” Else Application.

  IEC 801-5 PDF

ActivePrinter ‘ do something with the temp printer Application. ActivePrinter End Sub And this is the function: StdRegProv” ‘ get the Devices from the registry regobj.

Programming Excel with VBA and .NET by Steve Saunders, Jeff Webb

VBA stuff Tagged With: Comments Lewis Metzger says: Your code is simply brilliant. Thanks very much for this! Has made maintaining a bit of code here vvba simpler. Litle bit modify your code. E-mail subscription to new posts?

Please use the RSS Posts button above or click here. Recent comments cbd clinic products on Excel and XML: Return to top of page.