+ Reply to Thread
Results 1 to 10 of 10

VBA Change Active Printer

  1. #1
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    VBA Change Active Printer

    I was wondering if someone could help me out with what seems like a simple task... I am trying to print a userform to a pdf printer AND to a network printer at the same time, but without success. For some reason the printer does not change to the pdf printer.

    The network printer must stay as the default printer. I am using NovaPDF and have it setup to save automatically save with no "Save As" popup. If someone has some fresh code, it would help me out as I think I am going nuts. I have played around with this for 2 days on separate PC's with the same results. I have changed the order of this code more times than I can count just trying to get something different to happen.

    Please Login or Register  to view this content.
    Note --- I have also used the export to pdf in Excel which does work, but my userform has barcodes on it and this method resizes it just enough where my barcodes do not scan when printed. The output from printing to PDF printer WILL allow the barcodes to scan.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Change Active Printer

    As a test, does it print to the PDF printer without switching.

    Please Login or Register  to view this content.
    I guess I want to know if there is any issue with printing to the PDF printer driver or is there an issue with switching between the two.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: VBA Change Active Printer

    AlphaFrog ... Thanks for the reply.

    If I have the network printer as default like I need it to be, I will get two form print outs on the network printer. For some reason it will not switch. If I set manually to the PDF printer, no problem printing as pdf, but it will also not switch to the network printer. I have tried many combos without luck and on different PC's.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Change Active Printer

    As best I can tell, the .PrintForm method doesn't use the Application.Printer setting.

    This is from the .PrintForm help.
    Remarks

    The printer used by PrintForm is determined by the operating system's Control Panel settings.
    I'm looking into how to set the Control Panel printer from VBA and will post back if I find something.

  5. #5
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: VBA Change Active Printer

    Thanks AlphaFrog ... I will continue to play around with this. I really need it to work, anything you find is greatly appreciated.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Change Active Printer

    Give this a try. This is uncharted territory for me. So it may or may not work.

    Put the Private Declare Function... at the very top of the UserForm code module.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: VBA Change Active Printer

    AlphaFrog, you are a genius. This works EXACTLY how I need it to. Thank You very much for your time and help, it is GREATLY appreciated.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Change Active Printer

    Cool!

    Out of curiosity, what version of Windows are you using? I wasn't sure if this was Windows-version dependent. Apparently not.
    Last edited by AlphaFrog; 05-03-2014 at 08:57 PM.

  9. #9
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: VBA Change Active Printer

    I am using Windows 7 Pro.

  10. #10
    Registered User
    Join Date
    05-27-2014
    Posts
    1

    Re: VBA Change Active Printer

    Hey, I was having the same problem some time back when I was trying to print to a pdf printer and network printer simultaneously.. I was having the issue of switching between the two.. Then I got the similar solution for it and it really works..


    Printer Support

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Changing the active printer
    By Mats Samson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2012, 04:41 PM
  2. Simple VBA to set Active Printer up
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2007, 09:06 AM
  3. Setting the active printer
    By Boog in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2006, 11:15 PM
  4. [SOLVED] Setting the active printer
    By Boog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2006, 08:55 PM
  5. active printer
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-29-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1