Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to print Word doc to a printer name?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01266578
Message ID:
01266582
Views:
11
>I have a routine that prints a Word document (from VFP application, of course). But it prints document to a default printer. The segment of the code that prints the document is as following:
>
>
>	oDocument = oWord.Documents.Open( cFile2Attach )
>	if type( "oDocument" ) = "O" and !isnull( oDocument )
>	  oDocument.PrintOut(.F.)
>	  oDocument.Close()
>       endif
>
>
>Where in the above code I can specify where (printer name) to send this document? And what is the syntax?
>
>Thank you in advance for any help

Try:
#DEFINE wdDialogFilePrintSetup 97
lcPrinter = GETPRINTER()

oWord = CreateObject("Word.Application")

WITH oWord.Dialogs(wdDialogFilePrintSetup)
     .Printer              = lcPrinter
     .DoNotSetAsSysDefault = .t.
     .execute()
ENDWITH
Can't test it right now
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform