I am trying to send the form to a printer other than the default printer using: Printer = “HP LaserJet Series PCL on LPT4:”. There’s a property of the Application object called ActivePrinter. You could just You will need a little more information to set the ActivePrinter. The Printer property needs to be changed in the registry code in order to print from a different printer other than the default printer. If we need to .
|Published (Last):||7 October 2009|
|PDF File Size:||5.43 Mb|
|ePub File Size:||5.87 Mb|
|Price:||Free* [*Free Regsitration Required]|
Changing the active printer in a macro Alright, I tried the full string, and just the printer name, and the port. Thread Tools Show Printable Version. Thanks Paul, I would do that if I knew how to!!
Hello andy, You need to include the colon “: I ran the macro just now, and it gave a completely different port. Changing the active printer in a macro. Otherwise, it will try to print from the other connected printer. activeprimter
Help Contact Us Go to top. 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? Please use the RSS Posts button above or click here. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework. Ozgrid is Not Associated With Microsoft. Exit Do Activeprinnter Else: Just loop through the possible network numbers with an On Error resume next and error check Hello I am having trouble printing a page to both a local printer which works fine and a network printer which does not work Both printers are installed on the Computers.
Use API functions to retrieve all your installed printers and there port names from the registry.
[Application.]ActivePrinter [= setting] – Programming Excel with VBA and .NET [Book]
Share it with others Like this thread? Entia non sunt multiplicanda sine necessitate. This is the code to test the function: All three errored me out.
You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country aftiveprinter this forum is hosted. Last edited by RoryA; Sep 11th, at Configure the printer ports in Windows.
Application.ActivePrinter property (Excel)
Changing the active printer in a macro There’s a property of the Application object called ActivePrinter. Changing the active printer in a macro Hello andy, You need to include the colon “: So your code not such universal.
You could just set that if you know the name of the printer: Returns and array of printer names and port numbers on the user’s computer. Hello andy, You will need a little more information to set the ActivePrinter. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Register now while it’s still free!
Network Printer ‘ActivePrinter’ of object’_Application’ failed – Free Excel\VBA Help Forum
ActivePrinter End Sub And this is the function: The codes that I have used are Code:. Red Flag This Post Please let us know here why this post is inappropriate. Exit Function Do Start: I have 32 bit Windows API code that gets the device names and works well locally, but needs additional work for network printers. Resources saved on this page: Sounds a little bit better.