Consulting

Results 1 to 6 of 6

Thread: Solved: ActivePrinter

  1. #1

    Solved: ActivePrinter

    Ok! I have a ss that I create a report, print it and also print labels from captured data. This works great on my PC as I use the ActivePrinter option to switch printers to the label printer ie. Sheets("1").Printout ActivePrinter :="Dymo". However I now have to let a couple of other guys use this ss, and after printing the label I would like Excel to revert back to their default printer. Otherwise I would have to change the code for each individual.

    Any help gratefully accepted.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Maybe you could use Application.ActivePrinter
    See this thread for ideas and search the forum for printer. This has been discussed before but I don't remember much about it. The knowledgebase also has several entries dealing with printer selection

    http://www.vbaexpress.com/forum/show...hlight=printer
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Thanks Lucas,

    Loads for me to look at to find a fix. I'll mark this solved for now and get back if I need to

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    The KB Item here http://vbaexpress.com/kb/getarticle.php?kb_id=528 contains code to change a printer. It looks complicated, but the main function should not require any changes, its sole purpose is to add the port (or whatever it is) that a named printer uses. ie MyPrinter on Ne01: Unfortunately, this can be different for each PC for the same printer.
    Let us know if you need help implementing this.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Thanks MD, I'll have a look :o)

  6. #6
    Hey MD,

    Thanks for the link, thats a pretty scary peice of code for a newbie like me! It works a treat.

    It's still not quite what I'm looking for because the code requires that I know what the names of the printers are called on the PC that the code is running on.

    All I need is that when I have printed a label using the Printout.ActivePrinter method, the Active printer is returned to whatever the user has selected as his default windows printer.

    I can of course get around this by installing printers on their PC with generic names and writing the code to suit, but there must be a cuter way to do it...If I was clever enough.

Posting Permissions

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