Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How do I print a MS Word document to to a PostScript printer

Keywords:   print a MS Word documentPostScript printer 

Question:

How do I print a MS Word document to to a PostScript printer (port is file) and pass the file name I want to use.

Answer:

;	create word object...
oWord = objectopen("Word.Application")
;	set the documents object...
oDocs = oWord.documents
;	open a preset file...
oDocs.open("C:\temp\test.doc")
;get active document
oDoc = oWord.ActiveDocument
;	make word visible...
oWord.visible = @True ;Change to @False to hide
oWord.PrintOut(::FileName="C:\temp\test.doc")

oDoc.Save
oDoc.Close
oWord.Quit
ObjectClose(oDoc)
ObjectClose(oDocs)
ObjectClose(oWord)