Excel Macro - change printer

Giganews Newsgroups
Subject: Excel Macro - change printer
Posted by:  Samrcat
Date: Thu, 18 May 2006

I am trying to set up a print macro which automatically print to a
pre-selected printer (LABEL) instead of the default printer on the computer
(KYOCERA).

When complete, the macro must switch back to the default printer (KYOCERA).
This macro is used on several machines in the office and each machine has a
different Ne__ numbers for the the same printers.

  ActiveSheet.PageSetup.PrintArea = "$P$8:$Y$13"
    Application.ActivePrinter = "label on Ne05:"
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
        "label on Ne05:", Collate:=True
  Application.ActivePrinter = "KYOCERA FS3820N on Ne06:"

The Ne__ number appears to be the printer's installation order. When you
change printers (as we have needed to do), the Ne number changes rendering
the macro useless.  I have had to change these things SEVERAL TIMES on
SEVERAL machines.

I want to find a way to define the KYOCERA and LABEL printers without using
those Ne__ numbers so the same macro will work throughout the office and if
one of the available printers is uninstalled, order changes, the macro will
continue to work. All the machines in question use Windows XP Pro on a
network. This problem did not appear when we were on windows 98!

Replies