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.
|Published (Last):||8 May 2009|
|PDF File Size:||19.47 Mb|
|ePub File Size:||16.17 Mb|
|Price:||Free* [*Free Regsitration Required]|
Is there a way of creating a list of Active Printers on a users computer activepriner the user to select to be used in the PrintOut method i. Changing the active printer in a macro Leith Ross – When you 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.
Thanks for the suggestion, it works ok on my pc, but unfortunately I am having a couple of problems.
All times are GMT To give a better idea I have created a dynamic page of graphs and to print all the graphs activeprknter need to change Source Data and then print the page so I cannot do a Print Entire Workbook Please use [code] tags when posting code. This will get the list of availble printers. You can then loop through the list with code like: Any ideas would be appreciated ActivePrinter activeprinrer your default printer, in my case usually a Laserjet.
Login or Sign Up.
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. ActivePrinter ‘ do something with the temp printer Application.
Do I make the code line application. Changing the active printer in a macro Hello andy, You will need a little more information to set the ActivePrinter.
You can change the ActivePrinter property of the Application object to set a new default printer. This is the code to test the function: Has made maintaining a bit of code here much simpler.
ActivePrinter in PrintOut Method – Free Excel\VBA Help Forum
Recent comments cbd clinic products on Excel and XML: Thanks for your help! Option Explicit ””””””””””””””””””””””””””””””””’ ‘ modListPrinters ‘ By Chip Pearson, chip cpearson.
In particular there is a localization issue. Hello andy, You need to include actifeprinter colon “: Member List Calendar Forum Rules. ActivePrinter End Sub And this is the function: At startup Excel will set Application.
Application.ActivePrinter property (Excel)
Changing the active printer in a macro There’s a property of the Application object called ActivePrinter. Does it need a particular library? Last edited by RoryA; Sep 11th, at Returns and array of printer names and port numbers on cba user’s computer.
Please use the RSS Posts button above or click here. Become a Registered Member free to remove the ads that appear in thread area.
Remember to make a copy of your spreadsheet before running any macros that might change the data – macros can’t be undone! Results 1 to 10 of Exit Do Case Else: Just what I was looking for.
ActivePrinter in PrintOut Method. Probably it would be: Thanks very much for this!
All three errored me out.