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: | Dugami Nijinn |
Country: | Chad |
Language: | English (Spanish) |
Genre: | Technology |
Published (Last): | 28 March 2005 |
Pages: | 61 |
PDF File Size: | 17.34 Mb |
ePub File Size: | 2.98 Mb |
ISBN: | 673-2-89728-909-3 |
Downloads: | 46145 |
Price: | Free* [*Free Regsitration Required] |
Uploader: | Kekree |
You may have to register before you can post: Return to top of page. I expected that this would do it: We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity.
ActivePrinter ‘ do something with the temp printer Application. For additional details, refer to our Privacy Policy.
Programming Excel with VBA and .NET by Steve Saunders, Jeff Webb
Thanks for your help! ActivePrinter End Sub And this is the function: Changing the active printer in a macro Hello andy, You will need a little more information to set the ActivePrinter.
I have 32 vbs Windows API code that gets the device names and works well locally, but needs additional work for network printers. Excel on Windows Run the macro “ShowPrintersAndPorts”.
Ozgrid is Not Associated With Microsoft.
excel vba alternate active printer – Stack Overflow
Changing the active printer in a macro There’s a property of the Application object called ActivePrinter. Do I need to define a variable first? Leith Ross ‘ Summary: I ran the macro just now, and it gave a completely different port.
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. Replacing USB with that solved the issue.
Solved that my problem — added the line ThisWorkbook. To start viewing messages, select the forum that you want to visit from the selection below. 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 I almost decided to hard code the string for the above mentioned languages when I realized that the solution is already there.
Use API functions to retrieve all your installed printers and there port names from the registry. Share it with others Like this thread?
Thread Tools Show Printable Version. August 05, ‘ Authoer: 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 vbq file.
Printer property (Excel) | Microsoft Docs
Any ideas would be appreciated Login or Sign Up. 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: All three errored me out. Last edited by RoryA; Sep 11th, at Changing the active printer in a macro Hello andy, You need to include the colon “: Remember to make a copy of your spreadsheet before running any macros that might change the data – macros can’t be undone!
The time now is E-mail subscription to new posts? Comments Lewis Metzger says: Please use [code] tags when posting code. Thanks for the suggestion, it works ok on my pc, but unfortunately I am having a couple of problems. VBA stuff Tagged With: At startup Excel will set Application. Essential Tools For Developers.