+ Reply to Thread
Results 1 to 7 of 7

Use VBA to print to a specific printer

  1. #1
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Use VBA to print to a specific printer

    I have a printer named 'eCopy PaperWorks Printer' with the port showing as 'ECOPYPAPERWORKS' in the Print Preferences dialog box. What VBA code would I write if I wanted to print to this specific printer? Easy question, I know, but I'm new. Thanks.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Use VBA to print to a specific printer

    Have you tried recording a macro?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Use VBA to print to a specific printer

    I'll give that a try. Normally when I've done that, it prints to the default printer.

    OK, I created a macro selecting the eCopy printer and it created code that simply prints on the default printer. I need to specify a different printer for this task, not just the default. Thanks again.
    Last edited by rkjudy; 05-25-2011 at 06:36 PM.

  4. #4
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Use VBA to print to a specific printer

    Still going to default printer.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Use VBA to print to a specific printer

    Did you switch to the desired printer when you recorded the macro?

    What did the macro record?
    Last edited by shg; 05-25-2011 at 07:28 PM.

  6. #6
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Use VBA to print to a specific printer

    The macro recorded this:
    Please Login or Register  to view this content.
    Also I've tried this:
    Please Login or Register  to view this content.
    But it returns an error 'Method 'ActivePrinter of object_'Application' failed

    Any suggestions?

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Use VBA to print to a specific printer

    Hello rkjudy,

    This script will tell you the name of the printer and the port it uses. You can then use the name matching your printer to change the printer using Application.ActivePrinter.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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