Printing from Word (OpenInsight Specific)
At 07 DEC 2000 11:39:50AM b cameron wrote:
What is the best way to kick a word doc to the printer
from a OI form via a button?
For instance the word document may be
e:\share\docs\form1.rtf
Would like the button to invoke this to print to the default printer
but be tranparent to the user.
At 07 DEC 2000 12:20PM b cameron wrote:
I just reread this and realized that I need to be more specific.
This is not really an OI question. I I can use the runwin utility.
What I don't know is the switches to get word to open, read, print and close.
TIA
At 07 DEC 2000 02:15PM matt sorrell wrote:
Well, it seems to me you have two choices. You can either automate Word via DDE, or you can base the documents of off a template that includes a macro to automatically print.
Perhaps a better option would be to write a small VB app, giving you the advantage of accessing the Word DOM. You could runwin this VB app, and as a command line arguement pass the name of the document to print. The VB app would then instantiate Word, open the document, print the document to the default printer, and then exit.
This should only take around 30 - 40 lines of code, at most.
If you would like to see some sample code that would do this, let me know and I'd be glad to help out.
msorrel@greyhound.com
At 07 DEC 2000 02:29PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
For more reliable results use ShellExecute as follows :-
Prototype the DLL definition as DLL_SHELL
SHELL
ushort pascal ShellExecute(ushort, lpchar, lpchar, lpchar, lpchar, short)
then call it as follows :-
h=Get_Property(@Window, 'HANDLE')
verb=print' : \00\
file=C:\windows\script.doc' : \00\
parameters=\00\
directory=\00\
show=0
Declare Function ShellExecute
Z=ShellExecute(h, verb, file, parameters, directory, show)
World Leaders in all things RevSoft