+ Reply to Thread
Results 1 to 2 of 2

How Do I Code to print to a Printer by the Printer Name?

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

    How Do I Code to print to a Printer by the Printer Name?

    I have created a macro that prints to a certain printer. My problem is that the code created references the printer by NE01, NE02, NE03, etc. Because I add printers to my computer all the time, the NE number referring to this printer has changed. Therefore I get a debug error when I run this macro. My question: is there a way I can change the code to reference the printer NAME ONLY instead of having to add the NE number. This way my macro would always work regardless if I added new printers. The code is below. Thanks in advance.

    Please Login or Register  to view this content.

  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: How Do I Code to print to a Printer by the Printer Name?

    See http://www.cpearson.com/excel/GetPrinters.aspx

    That will give you a list of printers, which you can loop through to find one like "eCopy PaperWorks Printer *"

    Of, you could try Ne01, Ne02, ... until there is no error.
    Entia non sunt multiplicanda sine necessitate

+ 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. VBA code to print Userform to specific Printer
    By RossN in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2012, 06:03 PM
  2. VBA for print if cell contains, then choose printer. Have code just need advice.
    By lukestkd in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2012, 08:39 PM
  3. VBA code to print defined cells to a thermal label printer
    By parkles in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2012, 04:06 AM
  4. macro to print 2 copies to default printer, then 1 copy to Adobe PDF printer
    By jwright650 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2011, 01:07 PM
  5. Code to print all files in a folder (to default printer)
    By jwhitwell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2010, 04:35 PM

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