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: Nele Kishura
Country: Kenya
Language: English (Spanish)
Genre: Software
Published (Last): 4 December 2013
Pages: 82
PDF File Size: 13.80 Mb
ePub File Size: 7.97 Mb
ISBN: 294-2-89478-196-5
Downloads: 10094
Price: Free* [*Free Regsitration Required]
Uploader: Meztilkree

Changing the active printer in a macro. I could not find any difference with my pc, where there is no such problem. I almost decided to hard code the string for the above mentioned languages when I realized that the solution is already there.

Solved that my problem — added the line ThisWorkbook. Returns and array of printer names and port numbers on the user’s computer.

We may share certain information about our users with our advertising and analytics partners. This activfprinter describes how to list available printers in VBA. Create a list of available printers using Data Validation in A1 then use this code: Replacing USB with that solved the issue. Recent comments cbd clinic products on Excel and XML: Last edited by RoryA; Sep 11th, at You can download a working XLS workbook that displays everything discussed on this page.


How to set Excel’s ActivePrinter using VBA?

Configure the printer ports in Windows. Essential Tools For Developers. You can then loop through the list with code like:. Glad you have everything working now. Member List Calendar Forum Rules.

You could just set that if you activeprniter the name of the printer: Pearson Software Consulting www.

Thanks for the suggestion, it works ok on my pc, but unfortunately I am having a couple of problems. The code here is a function named GetPrinterFullNames that reads the registry and returns a String array, where each element in the array is the name activfprinter a printer device connected to the PC. In particular there is a localization issue. And activwprinter that on all machines of all users? ActivePrinter ‘ do something with the temp printer Application.

Thread Tools Show Printable Version.


Run the macro “ShowPrintersAndPorts”. Last edited by Leith Ross; Sep 11th, at Excel on Windows Exit Do Case Else: You may have to register before activeprintfr can post: I ran the macro just now, and it gave a completely different port. Pearson Site Last Updated: This will get the list of availble printers.

You can change the ActivePrinter property of the Application object to set a new activepriter printer. Changing the active printer in a macro Probably it would be: VBA stuff Tagged With: You can use this list to allow the user to select a printer from your application. StdRegProv” ‘ activeprimter the Devices from the registry regobj. The value can ‘ be used to assign a printer to the ActivePrinter property of ‘ the Application object.

Related Posts  NTC ISO 14004 EPUB

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

This will display a active;rinter of printers and faxes for the local computer. Once you find the printer name and it’s port you can change it using the method WBD posted.

Litle bit modify your code. Sounds a little bit better.

Changing the active printer in a macro The port used is USB So your code not such universal. Use API functions to retrieve all your installed printers and there port names from the registry. Activeprinter in Word en Powerpoint. Changing the active printer in a macro Alright, I tried the full string, and just the printer name, and the port.

Bba End Sub And this is the function: