Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel printing macro problem


Hi, I just can't get this to work - I keep getting Runtime error 1004 ?
The aim is just to print to another printer called 'HP 1200 Tray 2'

Any tips would be great. Thanks.

*Sub Printer2()

Dim STDprinter As String
STDprinter = Application.ActivePrinter
Application.ActivePrinter = "HP 1200 Tray 2 on
HPBusinessInkjet1200:"
' change printer
ActiveSheet.PrintOut
' prints the active sheet
Application.ActivePrinter = STDprinter
' change back to standard printer
End Sub*


--
Cam
------------------------------------------------------------------------
Cam's Profile: http://www.excelforum.com/member.php...o&userid=27836
View this thread: http://www.excelforum.com/showthread...hreadid=513986

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Excel printing macro problem


My guess:
excel doesnt use the 32bit portname but it's 16bit sibling.
e.g. MyPrinter on Ne01:

manually set the printer to the one you want.
type ?ActivePrinter in the immediate pane.
use that string in your code.


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


Cam wrote in


Hi, I just can't get this to work - I keep getting Runtime error 1004
? The aim is just to print to another printer called 'HP 1200 Tray 2'

Any tips would be great. Thanks.

*Sub Printer2()

Dim STDprinter As String
STDprinter = Application.ActivePrinter
Application.ActivePrinter = "HP 1200 Tray 2 on
HPBusinessInkjet1200:"
' change printer
ActiveSheet.PrintOut
' prints the active sheet
Application.ActivePrinter = STDprinter
' change back to standard printer
End Sub*

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel printing macro problem


..... your guess was spot on - you're a star.

Thanks bud.


--
Cam
------------------------------------------------------------------------
Cam's Profile: http://www.excelforum.com/member.php...o&userid=27836
View this thread: http://www.excelforum.com/showthread...hreadid=513986

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
Printing problem in excel Shreepad Gokhale Excel Discussion (Misc queries) 1 January 28th 10 01:52 PM
Excel 2003 printing problem--printing 1 document on 2 pages Bons Excel Discussion (Misc queries) 0 December 24th 09 04:15 PM
Printing problem in Excel Jake[_4_] Excel Discussion (Misc queries) 1 March 12th 09 07:52 PM
Printing Problem In Excel Due to Macro? [email protected] Excel Discussion (Misc queries) 4 March 20th 07 04:05 PM
Excel printing problem theNewb Excel Discussion (Misc queries) 1 November 2nd 05 07:41 PM


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

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

About Us

"It's about Microsoft Excel"