Get data from custom application in EXcel
I would like to be able to link some data from a custom application to a cell in Excel.
What technique would you use for this? I am, first of all, a Unix developer, and do not know the depth of win32 technologies. But as far as I understand, DDE will be the easiest, although it is a very old technology.
Being able to use it with other office suites like OpenOffice will be a big bonus.
a source to share
What does it mean to "link data from a custom application to a cell in Excel"?
Do you want your Excel sheet to display data generated by some external application?
If so, there are several options. Excel Data Provider is one way. This works if you have a lot of data that you want to download. For just one cell, this may be overkill.
If the external data is available through a network interface (say HTTP), you can write some Excel macro code to use it. You can use ServerXmlHttp object to use it from Excel. Some pointers to this are HERE.
Another way to do this is to expose data through a custom COM object, a reusable construct that's very handy for Excel. You have to write some code to do this, but it's not too difficult. You can write this in .NET, C ++, Javascript, VBScript, PerlScript, ...
a source to share
All of the solutions I've seen here have a data push approach. Why not take responsibility for bringing this data into Excel itself? Excel has the ability to add data via oleDB and ODBC. (at least from the version I know) I can only test this in Office2007, the only version I have on my machines.
All you have to do is add this table to the data tab table. Pretty simple. This way you are also relieved of the burden to maintain the code in your application, to open Excel, to run some code to output the code to cells, etc. Maybe you can record a macro for this and run it when the excel sheet opens.
Yonathan,
If the source application stores data in a database or text file, it will be possible to use the excels function in the data function to retrieve it. Otherwise I would agree with Dayton to integrate with VS2008. You can use VS2005, however you need to install VSTO.
Regarding DDE - in contrast to the fact that you are almost outdated, there are problems when using different versions of Excel and different languages, for which you will need to use different keywords for the same operation.
a source to share