Print a word doc from Excel
Peter,
Below is a vbScript that I've used to have Word print documents on a printer
other than the current default printer. It should be easy to modify and
incorporate into your VBA routine.
__________________________
' Print a text file to a printer other than the default printer using MS
Word
' Steve Yandl
Const wdDialogFilePrintSetup = 97
Const wdDoNotSaveChanges = 0
' Designate text file to be printed and correct name for the printer to be
used.
txtFile = "C:\Test\Test.txt"
strPrntChoice = "hp psc 2500 series"
' Create a hidden instance of Word, insert text file into new document,
choose printer and printout.
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.InsertFile(txtFile)
With objWord.Application.Dialogs(wdDialogFilePrintSetup )
.Printer = strPrntChoice
.DoNotSetAsSysDefault = True
.Execute
End With
objDoc.PrintOut
objDoc.Close(wdDoNotSaveChanges)
objWord.Quit
_________________________
Steve Yandl
"Peter" wrote in message
oups.com...
Calling the finest minds of this group:
I have a macro that is editing a word doc, that part is fine. The
problem is how to change the printer settings to use the colour
printer!
Does anyone have any ideas?
Thanks,
Peter
|