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: Nahn Kigagor
Country: Djibouti
Language: English (Spanish)
Genre: Technology
Published (Last): 19 July 2008
Pages: 284
PDF File Size: 13.49 Mb
ePub File Size: 3.14 Mb
ISBN: 284-9-72476-693-1
Downloads: 58073
Price: Free* [*Free Regsitration Required]
Uploader: Doutaur

Error in line: Is there a line I can add to the macro to select the correct printer so I can JUST activate it without having to sidetrack? Changing the active printer in a macro Alright, I tried the full string, and just the printer name, and the port. This will display a list of printers and faxes for the local computer. I could not find any difference with my pc, where there is no such problem. This will get activeprinte list of availble printers. VBA stuff Tagged With: Changing the active printer in a macro Hello Andy, You’re welcome.


ActivePrinter End Sub And this is the function: Print “No match” Else Application. Forums Blogs Articles Groups. You may have to register before you can post: 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. I ran the macro just now, and it gave a completely different port.

Your code is simply brilliant. Vvba startup Excel will set Application. Last edited by Leith Ross; Sep 11th, at We may share certain information about our users with our advertising and analytics partners. Thread Tools Show Printable Version.

Activeprinter in Word en Powerpoint.

wctiveprinter Please use the RSS Posts button above or click here. Remember to make a copy of your spreadsheet before running any macros that might change the data – macros can’t be undone!

Essential Tools For Developers. Add a new VBA Module to workbook and paste the code below into it.

Printers In VBA

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 of a printer device connected to the PC. This is the code to test the function: Ozgrid is Not Associated With Microsoft.

  GOST 535-88 PDF

Results 1 to 10 of Hello andy, You need to include the colon “: Changing the active printer in a macro Hello andy, You will need a little more information to set the ActivePrinter. Run the macro “ShowPrintersAndPorts”. Do I make the code line application. This page last updated: Litle bit modify your code.


Use API functions to retrieve all your installed printers and there port names from the registry. How to get the port of a printer? Hello Andy, You’re welcome.

Please use [code] tags when posting code. I expected that this would do it: Do I need to define a variable first? I expected that this would do it:. Comments Lewis Metzger says: All contents Copyright by MrExcel Publishing. So your code not such universal. Create a list of available printers using Data Validation in A1 then use this code: Option Explicit ””””””””””””””””””””””””””””””””’ ‘ modListPrinters ‘ By Chip Pearson, chip cpearson.