ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing according to computer (https://www.excelbanter.com/excel-programming/401714-printing-according-computer.html)

wayno

Printing according to computer
 
This is for anyone who needs it...

I needed a macro that would first check for the computername and then print
a selected number of copies to that computers printer.. I needed this so I
could use one main pricelist/workorder on all the mamchines in the office and
still have the print button i made do what i needed.

The complete macro does the following:
1. verifies that salesperson name has been entered
2. check which computer the pricelist is being run on
3. prints a set number of copies to the above running computer
4. emails the dept head a copy of the workorder (customer name & PO in
filename)
5. resets the form for the next order.

Here is the computer check part..

Set WshShell = CreateObject("WScript.Shell")
Set ObjEnv = WshShell.Environment("Process")
COMPUTERNAME = ObjEnv("COMPUTERNAME")


If COMPUTERNAME = "GRAPHICS" Then ActiveWindow.ActiveSheet.PrintOut From:=1,
To:=1, Copies:=2, Collate:=True, ActivePrinter:="Epson Color" Else

If COMPUTERNAME = "OFFICE" Then ActiveWindow.ActiveSheet.PrintOut From:=1,
To:=1, Copies:=2, Collate:=True, ActivePrinter:="Office Color" Else

If COMPUTERNAME = "CUSTOMER" Then ActiveWindow.ActiveSheet.PrintOut From:=1,
To:=1, Copies:=2, Collate:=True, ActivePrinter:="HP 1200" Else

Thanks for everyones help
wayne @ CNY Awards & Apparel, Inc.


All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com