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


right thanks. I've decided to use Franks approach and create a userfor
where the user selects which printer they want and then the correc
sheets in the spreadsheet are printed to that printer, so i have trie
to use this code

If UserForm1.OptionButton1.Value = True Then Application.ActivePrinte
= "\\TLPRWFC020001\tlnpwfc020001"

however i get an error when it runs saying "Method 'Activeprinter' o
object '_Application' failed".

any ideas whats wrong with my line of code?

thank

--
neowo
-----------------------------------------------------------------------
neowok's Profile: http://www.excelforum.com/member.php...nfo&userid=594
View this thread: http://www.excelforum.com/showthread.php?threadid=27202

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

select the printer manually.

now type in the immediate pane..
?application.activeprinter

you'll need to use the full string returned in the imm.pane
INCLuding the 16bit port Id. (Net01: or similar)




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


neowok wrote:


right thanks. I've decided to use Franks approach and create a userform
where the user selects which printer they want and then the correct
sheets in the spreadsheet are printed to that printer, so i have tried
to use this code

If UserForm1.OptionButton1.Value = True Then Application.ActivePrinter
= "\\TLPRWFC020001\tlnpwfc020001"

however i get an error when it runs saying "Method 'Activeprinter' of
object '_Application' failed".

any ideas whats wrong with my line of code?

thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default printing via vba

Neowok -

Alternately, you can invoke the Excel dialog and let your user select from
the known printers

strOldActivePrinter = Application.ActivePrinter
Application.Dialogs(9).show

If you want to capture the name by which Excel knows the selected printer -
you could also set a text
box's text to the new value

strNewActivePrinter = Application.ActivePrinter

After you print the selected sheets, be sure to return the ActivePrinter to
its original setting with

Application.ActivePrinter = strOldActivePrinter

Otherwise, your users will curse your name : )

James Cox


"neowok" wrote in message
...

right thanks. I've decided to use Franks approach and create a userform
where the user selects which printer they want and then the correct
sheets in the spreadsheet are printed to that printer, so i have tried
to use this code

If UserForm1.OptionButton1.Value = True Then Application.ActivePrinter
= "\\TLPRWFC020001\tlnpwfc020001"

however i get an error when it runs saying "Method 'Activeprinter' of
object '_Application' failed".

any ideas whats wrong with my line of code?

thanks


--
neowok
------------------------------------------------------------------------
neowok's Profile:

http://www.excelforum.com/member.php...fo&userid=5940
View this thread: http://www.excelforum.com/showthread...hreadid=272024



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
Excel 2003 printing problem--printing 1 document on 2 pages Bons Excel Discussion (Misc queries) 0 December 24th 09 04:15 PM
Excel Printing --Borders are not printing on the same page as data Stup88 Excel Discussion (Misc queries) 1 August 7th 07 09:34 AM
Printing a heading on each new page when printing Brian Excel Discussion (Misc queries) 3 November 15th 06 05:22 PM
Enable Double sided printing contiuously when printing multiple s. Lee Excel Discussion (Misc queries) 1 November 27th 04 01:58 AM
Printing? Worksheets not printing the same on multiple pc's! 43fan Excel Programming 2 April 29th 04 02:34 PM


All times are GMT +1. The time now is 12:23 AM.

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"