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: Babar Yozahn
Country: Cameroon
Language: English (Spanish)
Genre: Sex
Published (Last): 3 August 2016
Pages: 391
PDF File Size: 9.11 Mb
ePub File Size: 18.71 Mb
ISBN: 747-1-66145-994-8
Downloads: 35645
Price: Free* [*Free Regsitration Required]
Uploader: Kagor

Glad you have everything working now. I am bypassing the Print option but some users want to print in colour so I need to be able to select other printers and pass the name to the PrintOut method Ozgrid is Not Associated With Microsoft.

In particular there is a localization issue.

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

Add a new VBA Module to workbook and paste the code below into it. Recent comments cbd clinic products on Excel and XML: Exit Do Case Else: Once you find the printer name and it’s port you can change activepginter using the method WBD posted.


Has made maintaining a bit of code here much simpler.

This page last updated: We process personal data about users of activfprinter site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. The code on this page gets its list of printers from the system registry, specifically the key.

Changing the active printer in a macro Hello andy, You need to include the colon “: And do that on all machines of all users? 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. Do I need to define a variable first?

You can then loop through the list with code like: I have a macro that I use to change the fill color of cells, hide and unhide columns, and print 1 copy of each worksheet in the file. Your code is simply brilliant. Sounds a little bit better. For additional details, activepfinter to our Privacy Policy.

excel vba alternate active printer – Stack Overflow

VBA stuff Tagged With: ActivePrinter to your default printer, in my case usually a Laserjet. You may have to register before you can post: Last edited by Leith Ross; Sep 11th, at Pearson Site Last Updated: Otherwise, it will try to print from the other connected printer.

  101-68-8 MSDS PDF

ActivePrinter in the immediate window and got as reply: ActivePrinter End Sub And this is the function: Litle bit modify your code. Results 1 to 10 of Changing the active printer in a macro The port used is USB To give a better idea I have created a dynamic page of graphs and to print all the graphs i need to change Source Data and then print the page so I cannot do a Print Entire Workbook Cite this page as: Do I make the code line application.

So your code not such universal.

Excel on Windows