From: hannu on
Hi.

I have a vbs-file, which prints me word-document.

I would like to print it to different printers some times and I would
like to have a possibility to select printer during the code.

What is the code for that?


Thanks!
From: Tom Lavedas on
On Aug 18, 7:31 am, hannu <hannutlappalai...(a)gmail.com> wrote:
> Hi.
>
> I have a vbs-file, which prints me word-document.
>
> I would like to print it to different printers some times and I would
> like to have a possibility to select printer during the code.
>
> What is the code for that?
>
> Thanks!

WSH has the SetDefaultPrinter method. From the down loadable
documentation ...

Assigns a remote printer the role Default Printer.

object.SetDefaultPrinter(strPrinterName)

where object is the WshNetwork object.

If you do this before opening the Word object, it will send all print
jobs to that printer. Then reset it to back the original default
after.

There may also be a printer control in the Word VBA object model, but
I don't have the time to search that out.
_____________________
Tom Lavedas