LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Printing Data to Excel through ActiveX

Hi I was wondering if I might get some help in writing some code to print to an Excel Spreadsheet through ActiveX.  Attached is my current version of code that is not working the way I would like.
 
What I am hoping to do is to print every 5 seconds to the spreadsheet the data from the 4 sources I am collecting data from, as well as the time stamp of the current collection point.  When the Start Log button is pressed, then it should start writing out to the Excel spreadsheet every 5 seconds.  Then upon Stop Log being pressed, the data will stop being written.
 
Also if anyone has any general comments about things to change in the program overall, for better programming practice please let me know.  I am still fairly new to LabVIEW, and I am trying to create a decently efficient program.
 
Thanks
0 Kudos
Message 1 of 4
(2,610 Views)

Hi

Do you need to write to excel via activeX? I usually write a simple spreadsheet file where the values are separated with a character.

This is much easier and you can get rid of activeX. Maybe something you could think of.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 4
(2,604 Views)
I need to use ActiveX because I would like the ability to write new experiment data on different sheets of the spreadsheet.  I already have a version of the program which writes to different csv files for each new experiment.  This was easier to implement, but it was suggested that it would be nice to put the data all in one file on different tabs.

And my understanding is that the only way to do this is through ActiveX, otherwise I would stick with what I already have.

Thanks
0 Kudos
Message 3 of 4
(2,598 Views)
I coudln't look at where you were writing to the file because "Set Cell Value" was missing.  However, the code in the image will enable you to change the worksheets (assuming that's what you meant by tabs).  After you change the worksheet, just cast the value out into a worksheet, and continue on as I'm assuming you're already doing.

What Thomas said is also valid.  Unless you need this real-time, it may be simpler to save to a CSV, and then import it back into excel if you want it all in one file.


EDIT: I forgot to mention that worksheets are NOT zero indexed.  i.e. the left-most worksheet in excel is 1, not 0.

Message Edited by Will.D on 11-07-2006 11:33 AM

0 Kudos
Message 4 of 4
(2,596 Views)