11-01-2005 09:44 AM
I am currently using a Read Traces (numeric) vi to collect values from Tags and output them to a XY Graph. Alongside the graph on my front panel, I would like a boolean control to command (when true) LV to write the data to a spreadsheet and open that spreadsheet so it appears on screen, ready for the user to view and then save the excel file where he/she would like.
Is this possible? I am a little unsure what File I/O functions I need in order to achieve this? I have tried using the "Write Traces to Spreadsheet vi" available in the DSC module, but haven’t had much success. I have attached my code to show you how far I have got.
Any help with this problem will be very much appreciated.
Thanks,
Stuart Wilson
11-02-2005 12:36 PM
11-03-2005 05:24 AM
11-03-2005 07:50 AM
11-04-2005 06:30 AM
Hi Stuart,
I have written an example piece of code for you which has the basic functionaliy that you want.
The example plots random data to a chart. When the boolean is pressed this data is written to a spread sheet file and Excel is opened to display this data.
As it is a generic solution you need to replace certain items when you incorporate the structure into your code: Instead of writting the history data of a chart you can use the "write traces to spreadsheet.vi" to write the data. The automation of excel can then be used in the same way as in the example.
There is also an example available in the "LabVIEW Example finder" called "Write Table to XL.vi". This example takes the data from a table and cell by cell inserts it into an excel speadsheet. Which the operator can then save from within excel. However, this method is not the most efficient way to get data into Excel.
I hope this is helpful.
Emma R
NIUK & Ireland
11-04-2005 09:50 AM
11-04-2005 10:16 AM
Hi Stuart,
The error that you are getting is due to the fact that we have different versions of excel, I have Excel 2003. The following link details the error and it's solution.
11-07-2005 01:17 AM
11-07-2005 03:46 AM
Hi Stuart,
As we have different versions of Excel currently the Automation refnum within the VI is trying to link to an invalid source.
To fix this yo need to change the Refnum link:
If you go into the VI, right click on the refnum icon located on the front panel. Select "Active x class" option and choose "Browse". This will open the "Select Object From Type Library" popup box. In the "Type library" drop down, look for "Microsoft Object Library" and select the version that is current on your computer. Click OK to apply the change.
This change should hopefully update through the rest of your VI.
Hope this is helpful
Emma R
NIUK & Ireland
11-07-2005 08:49 AM