Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing To A Specified Printer
What would be the syntax to print 5 copies of the current
worksheet to a designated printer (and where do we get the printer name from) Thanks, Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing To A Specified Printer
Try this
Sub Printtest() Dim DPrinter As String DPrinter = Application.ActivePrinter Application.ActivePrinter = "hp officejet k series on Ne00:" ActiveSheet.PrintOut Copies:=5 Application.ActivePrinter = DPrinter End Sub This macro you can assign to a button To know the names of your printers Change to it in the ctrl P dialog (Cancel after choose the printer ) and run this so you know the name that you must use in the macros Sub nameprinter() MsgBox Application.ActivePrinter End Sub The PrintOut also have a ActivePrinter argument I don't know if this will set it back to the old printer when it is done?? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Steven Pearl" wrote in message ... What would be the syntax to print 5 copies of the current worksheet to a designated printer (and where do we get the printer name from) Thanks, Steve |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing To A Specified Printer
There is an unforseen consequence of using the suggestion proposed by Ron de
Bruin that you should be aware of: Suppose you specify a specific printer as an ActivePrinter object, for example, Application.ActivePrinter="HP LaserJet 4SI on LPT1:" Then what happens is that the system default printer across the entire Windows environment is changed to that printer, just as though you went to the Control Panel and made that change. Not only that, but it will make this change on an instantaneous basis, so other users in the middle of printing on the system will have their output messed up accordingly. This not-so-well-known bug in Excel is documented in MS Knowledge Base Article 209722. -- Dennis Eisen |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing To A Specified Printer
Thanks for the reply. That was exactly what I needed!! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing To A Specified Printer
That was perfect. One other question. If I want to specify
a specific tray to print to on that printer, can that be handled by the VB code as well? If so, how? Thanks a ton. -----Original Message----- Try this Sub Printtest() Dim DPrinter As String DPrinter = Application.ActivePrinter Application.ActivePrinter = "hp officejet k series on Ne00:" ActiveSheet.PrintOut Copies:=5 Application.ActivePrinter = DPrinter End Sub This macro you can assign to a button To know the names of your printers Change to it in the ctrl P dialog (Cancel after choose the printer ) and run this so you know the name that you must use in the macros Sub nameprinter() MsgBox Application.ActivePrinter End Sub The PrintOut also have a ActivePrinter argument I don't know if this will set it back to the old printer when it is done?? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Steven Pearl" wrote in message ... What would be the syntax to print 5 copies of the current worksheet to a designated printer (and where do we get the printer name from) Thanks, Steve . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing To A Specified Printer
Thanks Dennis
-- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "DennisE" wrote in message ... There is an unforseen consequence of using the suggestion proposed by Ron de Bruin that you should be aware of: Suppose you specify a specific printer as an ActivePrinter object, for example, Application.ActivePrinter="HP LaserJet 4SI on LPT1:" Then what happens is that the system default printer across the entire Windows environment is changed to that printer, just as though you went to the Control Panel and made that change. Not only that, but it will make this change on an instantaneous basis, so other users in the middle of printing on the system will have their output messed up accordingly. This not-so-well-known bug in Excel is documented in MS Knowledge Base Article 209722. -- Dennis Eisen |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing To A Specified Printer
Hi Steven
a specific tray to print to on that printer Sorry I don't have any experience with this I hope someone else can help you -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Steven Pearl" wrote in message ... That was perfect. One other question. If I want to specify a specific tray to print to on that printer, can that be handled by the VB code as well? If so, how? Thanks a ton. -----Original Message----- Try this Sub Printtest() Dim DPrinter As String DPrinter = Application.ActivePrinter Application.ActivePrinter = "hp officejet k series on Ne00:" ActiveSheet.PrintOut Copies:=5 Application.ActivePrinter = DPrinter End Sub This macro you can assign to a button To know the names of your printers Change to it in the ctrl P dialog (Cancel after choose the printer ) and run this so you know the name that you must use in the macros Sub nameprinter() MsgBox Application.ActivePrinter End Sub The PrintOut also have a ActivePrinter argument I don't know if this will set it back to the old printer when it is done?? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Steven Pearl" wrote in message ... What would be the syntax to print 5 copies of the current worksheet to a designated printer (and where do we get the printer name from) Thanks, Steve . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
problem printing to HP color printer | Excel Worksheet Functions | |||
Printing Simplex on a duplex printer. | Excel Discussion (Misc queries) | |||
Printing/printer setup re Excel | Excel Discussion (Misc queries) | |||
Printing with B&W printer | Excel Discussion (Misc queries) | |||
Printing from default printer | Excel Discussion (Misc queries) |