How to Perform a DDE Link with Word for Windows

Last reviewed: October 18, 1996
Article ID: Q96352
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 5.0
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY

The following code example shows how to link Microsoft FoxPro for Windows to Microsoft Word for Windows. This code sets up the dynamic data exchange (DDE) link, opens a Word for Windows file (CONVINFO.DOC) that is installed with Word, and terminates the link. This is a good test for a DDE link and can be run through the Trace window in FoxPro for Windows.

   RUN /N C:\WINWORD\WINWORD.EXE   && Starts Word
   iCHANNEL= DDEInitiate("WinWord", "System")
   =DDEExecute (iCHANNEL,'[FileOpen"C:\WINWORD\CONVINFO.DOC"]')
   * Opens doc installed with Word
   =DDETerminate(iCHANNEL)

This code does not close Word for Windows; it simply terminates the link between the two programs.

MORE INFORMATION

If you are using FoxPro for Windows version 2.x, you can refer to the additional sample code in the FOXPROW\SAMPLES\DDE subdirectory.

REFERENCES

Word for Windows "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: 5.00 VFoxWin 3.00 FoxWin 2.50 2.50a WinWord
KBCategory: kbinterop kbprg
KBSubcategory: FxinteropDde



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 18, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.