ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print a word doc from Excel (https://www.excelbanter.com/excel-programming/382293-print-word-doc-excel.html)

Peter[_61_]

Print a word doc from Excel
 
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


Tom Ogilvy

Print a word doc from Excel
 
In Excel it is
Application.ActivePrinter

I can't say for word.

--
Regards,
Tom Ogilvy



"Peter" wrote:

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



Steve Yandl

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





All times are GMT +1. The time now is 01:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com