View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default PrintOut Method, Set ActivePrinter with a variable


goto http://groups-beta.google.com
then type or copy:
list-of-printers group:*excel* author:keepitcool

you should get a reply from me to Tom dated jan 22nd 2005

it has a function that does it all very nicely (xl2000 or newer)
if you have xl97 search posts from me in this group on topic
"Printers List"




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Neuraxis wrote :

I would like to have an Excel macro print to a printer defined in a
variable so I dont have to hard code the printer name in the code.

I have been successful with the following code:
ThisWorkbook.PrintOut ActivePrinter:="Printer Name"

What I would like to do is something like:
Set PrinterNameVariable = "Printer Name"
ThisWorkbook.PrintOut ActivePrinter:=PrinterNameVariable

Any ideas?

Thanks