Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem printing to HP color printer toodi4 Excel Worksheet Functions 0 January 12th 09 07:36 PM
Printing Simplex on a duplex printer. jerrybdot Excel Discussion (Misc queries) 0 December 29th 08 11:55 PM
Printing/printer setup re Excel David Brereton[_2_] Excel Discussion (Misc queries) 0 August 4th 08 01:49 PM
Printing with B&W printer edwardpestian Excel Discussion (Misc queries) 1 July 25th 06 04:56 AM
Printing from default printer Susan Excel Discussion (Misc queries) 1 February 1st 06 04:23 PM


All times are GMT +1. The time now is 02:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"