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: Brabei Tegar
Country: Namibia
Language: English (Spanish)
Genre: Spiritual
Published (Last): 1 August 2014
Pages: 381
PDF File Size: 3.50 Mb
ePub File Size: 3.70 Mb
ISBN: 333-8-76143-889-5
Downloads: 38759
Price: Free* [*Free Regsitration Required]
Uploader: Samucage

This is the code to test the function: If this is your first visit, be sure to check out the Board FAQ by clicking the link above. ActivePrinter in the immediate window and got as reply: Any ideas would be appreciated Create a list of available printers using Acctiveprinter Validation in A1 then use this code: Configure the printer ports in Windows.

VBA stuff Tagged With: Become a Registered Member free to remove the ads that appear vga thread area. Exit Do Case Else: Glad you have everything working now.


Member List Calendar Forum Rules.

Login or Sign Up. ActivePrinter to your default printer, in my case usually a Laserjet. Thread Tools Show Printable Version. Cite this page as: Do I make the code line application. Recent comments cbd clinic products on Excel and XML: The problem I typed?

How to set Excel’s ActivePrinter using VBA?

Share it with others Like this thread? Changing the active printer in a macro. Option Explicit zctiveprinter ‘ modListPrinters ‘ By Chip Pearson, chip cpearson. Error in line: You need to know the printer’s name and the port it uses. This page describes how to list available printers in VBA.


Once you find the printer name and it’s port you can change it using the method WBD posted. The time now is All times are GMT 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. Changing the active printer in a macro The port used is USB Changing the active printer in a macro There’s a property of the Application object called ActivePrinter.

Help Contact Us Go to top. Hello andy, You need to include the colon “: So your code not such universal.


Printer property (Excel) | Microsoft Docs

Just what I was looking for. Do I need to define a variable first?

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.

Solved that my problem — added the line ThisWorkbook. ActivePrinter ‘ do something with the temp printer Application. Ozgrid is Not Associated With Microsoft.

Please post data in proper tables – I suggest this tool. Comments Lewis Metzger says: Excel on Windows You may have to register before you can post: Sounds a little bit better. You could just set that if you know the name of the printer: