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:
01266583
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

Borislav,

Thank you very much. I can't test it right now either. But will test it tomorrow.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform