Using DDE and Macro Substitution with FoxPro and WordLast reviewed: April 30, 1996Article ID: Q114492 |
The information in this article applies to:
SUMMARYThe following code example shows how to pass a filename stored in a memory variable to Microsoft Word for Windows using dynamic data exchange (DDE) and macro substitution.
MORE INFORMATIONThis code stores the desired path and filename to a memory variable called x using the GETFILE() function, starts the DDE link, and opens (using macro substitution) the Word for Windows file whose name is stored in the memory variable x. At this point, the document can be edited in Word. Then the link to Word is terminated, returning control to the client application (FoxPro). This example is useful for selecting and processing a file dynamically using FoxPro for Windows as the client and Word for Windows as the server application.
*** CALLWORD.PRG *** X = GETFILE() && Gets file name from user RUN /N C:\WINWORD\WINWORD.EXE && Starts Word iCHANNEL= DDEInitiate("WinWord", "System") && Initiates DDE channel * The following command opens the desired document using a generic * memory variable called x with macro substitution. =DDEExecute(iCHANNEL,'[FileOpen "&X"]') =DDETerminate(iCHANNEL) && Terminates DDE channel REFERENCESWord for Window "User's Guide," version 2.0, Chapter 42, "Using Macros" Word for Windows Help file, version 2.0, "WordBasic Programming Language" "Using WordBasic," Microsoft and Wextech Systems, Inc., Chapter 5, "Dynamic Data Exchange"
|
Additional reference words: VFoxWin 3.00 FoxWin 2.50 2.50a 2.50b 2.60
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |