07-14-2008 02:26 PM
07-15-2008 09:48 AM
Hi Internati...
VBA can call external DLLs and ActiveX servers, and DIAdem has two ActiveX servers available (ToCommand, ToDataSheet). So yes, any application (even Excel) can call DIAdem through ActiveX, send it data over ActiveX or send a file path and tell it to load the file, then tell it to run some analysis and send the results back to the calling application. This requires that DIAdem be installed on the same computer that the calling application (i.e. Excel) is on, but it should work fine, if you're willing to put in the programming effort.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-15-2008 09:57 AM
07-15-2008 01:46 PM
07-16-2008 07:45 AM
Thanks for the additional reply! It appears that I would have to use OLE to "write" the data to DIAdem, then execute the DIAdem command I want on the DIAdem data, the use OLE to "write" the results back to Excel. I hope I have the steps correct. It also appears the only way to do this is value by value.
I shall give this a try.
Thanks again!
07-16-2008 10:19 AM
Hi Internati...
You have the steps correctly outlined. There are methods in the DIAdem ActiveX server to send and receive blocks of data, but I honestly don't know if they will be compatible with the blocks of data that you can read and write with VBA in Excel. These methods were created with C pointers in mind, and they do not work with native variant arrays. Still, VBA can explicitly data type variable, so perhaps it could work, but I can't help you with the details. The simplest approach would be the following:
1) Assemble a variant array from all the Excel cells
2) Send the variant array to DIAdem via ActiveX
3) Assign the variant array to DIAdem channels using "ArrayToChannels()"
4) Run the DIAdem analysis to create result channels
5) Assemble a variant array from all the DIAdem cells in the result channels (cell by cell)
6) Send the variant array back to Excel via ActiveX
7) Assign the variant array to target Excel cells
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-16-2008 10:46 AM
Thanks, Brad and DRock! This looks doable. I appreciate your efforts and time on this one.
Time to code!