I am trying to send the form to a printer other than the default printer using: Printer = “HP LaserJet Series PCL on LPT4:”. There’s a property of the Application object called ActivePrinter. You could just You will need a little more information to set the ActivePrinter. The Printer property needs to be changed in the registry code in order to print from a different printer other than the default printer. If we need to .

Author: Fenrizil Gujin
Country: Sudan
Language: English (Spanish)
Genre: Photos
Published (Last): 12 August 2013
Pages: 389
PDF File Size: 19.8 Mb
ePub File Size: 12.12 Mb
ISBN: 582-8-34670-662-5
Downloads: 26882
Price: Free* [*Free Regsitration Required]
Uploader: Nagami


Changing the active printer in a macro. Thanks for the suggestion, it works ok on my pc, but unfortunately I am having a couple of problems. Configure the printer ports on each machine to have the same applicaion for the Win2PDF printer Just a thought –Paul It’s important in life to always strike a happy medium, so if you see someone with a crystal ball, and a activwprinter on their face Thanks very much for this!

All times are GMT VBA stuff Tagged With: How to get the port of a printer?

[Application.]ActivePrinter [= setting] – Programming Excel with VBA and .NET [Book]

Students Click Here Join Us! Do I make the code line application. Litle bit modify your code. You could just set that if you know the name of the printer: Share it with others Like this thread? Any help will be appreciated. Forums Blogs Articles Groups.


Return to top of page. Exit Do Case Else: Login or Sign Up.

Printer property (Excel) | Microsoft Docs

Dialogs xlDialogPrinterSetup and ask the user to select the printer. I almost decided to hard code the string for the above mentioned languages when I realized that the solution is already there.

Recent comments cbd clinic products on Excel and XML: That’s definitely another way, that should work, but its also important to take control of your network, while you still can.

Red Flag This Post Please let us know here why this post is inappropriate.

I ran the macro just now, and it gave a completely different port. Does it need a particular library? The time now is ActivePrinter ‘ do something with the temp printer Application. In particular there is a localization issue.

By joining you are opting in to receive e-mail. Changing the active printer in a macro Leith Ross – When applicatikn said I needed the printer name and port, I accessed the devices and printers instead of running the macro, and when I saw on USB, it stood to reason that that was the port. Thread Tools Show Printable Version.


Hello I am having trouble printing a page to both a local printer which works fine and a network printer which does not work Both printers are installed on the Computers. The codes that I have used are Code:.

How to set Excel’s ActivePrinter using VBA?

Member List Calendar Forum Rules. This is the code to test the function: Help Contact Us Go to top. I’m not sure whether the assignment for net port is a appllication thing or variable everytime you restart the pc. Otherwise, it will try to print from the other connected printer.

I expected that this would do it: Just loop through the possible network numbers with an On Error resume next and error check Excel not only wants to know the printer name but also the port name of the printer, which can be something like Ne01, LPT1, Nul or any IP address. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Changing the active printer in a macro Probably it would be: