printing via vba

  • Thread starter Thread starter neowok
  • Start date Start date
N

neowok

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
 
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 -

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top