How to Use DDE to Get Microsoft Excel Version in FoxPro App

Last reviewed: June 26, 1995
Article ID: Q129791
The information in this article applies to:
  • Microsoft FoxPro for Windows version 2.6a

SUMMARY

This article gives a convenient way to obtain the version of Microsoft Excel to which a DDE channel has been established in a FoxPro for Windows application.

MORE INFORMATION

In the following example, the Microsoft Excel INFO() function is poked into a cell in the Microsoft Excel spreadsheet to which a DDE channel has been established. The value of this function is then returned to FoxPro. Sheet1 is the name of the worksheet used in the example, and Row 1 Column 1 (R1C1) was arbitrarily chosen to hold the function. Both of these choices can be modified at the developer's discretion.

Code Sample

To demonstrate this code example, type the following into a new program file (.PRG file) and run it:

   channel = ddeinitiate('Excel','sheet1')
   success = ddepoke(channel,'R1C1','=INFO("release")')
   excelver = dderequest(channel,'R1C1')
   wait window excelver

The variable 'excelver' now holds the version number of Microsoft Excel.


Additional reference words: FoxWin 2.60a
KBCategory: kbinterop kbprg kcode
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: June 26, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.