List Info

Thread: ActivePrinter Code Failing




ActivePrinter Code Failing
country flaguser name
United States
2007-04-13 12:22:48
Greetings!

I'm running Excel 2003 under XP Pro.

A few months ago I recorded/modified a macro that will allow
me to print to 
my local printer and then reset my printer back to my
default network printer. 
Note the Ne02: and Ne08: references in the code.

  Sub Print3600()
     ActiveWindow.SelectedSheets.PrintOut Copies:=1,
ActivePrinter:= _
         "hp deskjet 3600 series on Ne02:"
     Application.ActivePrinter =
"\PrintServerNameLASER10 on Ne08:"
  End Sub

Recently, this macro stopped working, so I recorded it again
and noticed that 
the Ne0x: references have changed.

  Sub Macro1()
     ActiveWindow.SelectedSheets.PrintOut Copies:=1,
ActivePrinter:= _
        "hp deskjet 3600 series on Ne03:"
     Application.ActivePrinter =
"\PrintServerNameLASER10 on Ne09:"
  End Sub

Is there a way for VBA to find the Ne0x value of the local
printer before 
setting it as the ActivePrinter so I can a build a string
that will always work?

I am able to find the Ne0x value for the default network
printer by starting the 
code with: 

NetNe = Right(Application.ActivePrinter, 3)

But what about my local printer? How would I get it's Ne0x
value so I can build 
the correct string each time the macro runs?

Thanks!

------------------------------------------------------------
--------------
The EXCEL-G list is hosted on a Windows NT(TM) machine
running L-Soft
international's LISTSERV(R) software.  For
subscription/signoff info
and archives, see htt
p://peach.ease.lsoft.com/archives/excel-g.html .
                             COPYRIGHT INFO:
http://peach.ease.lsoft.com/scripts/wa
.exe?SHOWTPL=COPYRIGHT&L=EXCEL-G

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )