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

ID: Q129791

The information in this article applies to:

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

Last Reviewed: June 26, 1995