>I have a field in a table which stores the path of a Word document. I want to create a command button on a form that when I press it, it prints the Word document. How can I accomplish that with the RUN command? Is there a way that I can incorporate DDE (Dynamic Data Exchange)? Is there a way to detect if Word is already open?
Here's a quick and dirty way that works for me (VFP 6.0 SP3, Windows 95):
DECLARE INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
ShellExecute(0,"Print",lcFileName,"","",1)
Where lcFileName contains the name of the file you want to print.
If you have VFP 6.0, there is an _environ.vcx that has a _shellexecute method you could use. I'm not sure how to tell if a user already has Word open.
Chris McCandless
Red Sky Software