Controlling MS Word via scripting can be very handy for automating tasks, Populate lots of letters with customer name, order details, etc. and save them as Docx or PDF. Sometimes you need to print all those documents at once. This can be done easily via VBscript. Then you will notice that Word prints to the default printer.
What if you need to print to multiple printers, for example 1 set of documents to a Black and White printer, and another set of documents to a color printer? Then you need to be able to specify which printer you want to use. It looks like there is no good solution for that. Closest approach is to change the default printer temporary, and then back right after job is done (via scripting). That is not an option if you have multiple tasks running for BW printer and color printer in parallel.
We found a way to automate the printer selection within the print script, in VBscript:
DocFilename = "c:\temp\printMe.docx"
PrinterName = "\\server.domain.local\HP-Laserjet5"
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
Set objDoc = objWord.Documents.Open(DocFilename )
objWord.WordBasic.FilePrintSetup PrinterName, , , 1 '<– this 1 means not to store the change of printer.
objDoc.PrintOut
objDoc.Close
objWord.Quit
I hope you find it usefull.
We have 20 year of experience in automating Office tasks, if you need help, reach out to us.