LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading an activex spreadsheet

Hello all,
 
I am trying to use ActiveX to place a spreadsheet in my VI, and just initialize a 2D array containing whatever data the user enters.  I originally just used a table, converted hex strings to numbers, and used the array size function to determine the numbers of rows and columns.  The 2D array is sent to a DLL in unsigned short int form.  However, it is difficult to work with the table control (e.g. it seems that you cannot cut and paste a number of cells at one time), and this is why I would like to work with Excel if possible.
 
First of all, should I be creating a control in the ActiveX container (MS Office Spreadsheet), or creating a document (MS Excel)?  Once I have the spreadsheet on my VI, can I easily convert the data from hex strings to a 2D array of numbers (as I did with the old table described earlier)?  I have been shot down on every one of my attempts thus far.
 
I have been looking through old threads for quite awhile now, but I haven't found a clear answer to my questions. 
 
Thanks for your time.
John
0 Kudos
Message 1 of 12
(3,479 Views)
Found this, this morning. Not sure If it will help but hopefully it will give you some more ideas! http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3D7A556A4E034080020E74861&p_node=DZ53003&p_source=external
0 Kudos
Message 2 of 12
(3,466 Views)
Thanks for the reply, but I'm not finding answers in there yet.
 
Again, I would just like to have a spreadsheet on my front panel where the user can enter data (in hex format).  Then I want to convert this data into a 2D array of unsigned short ints.  That array needs to be sent to a DLL. 
 
Among other things, I tried connecting the output of two different ActiveX objects (1. MS Spreadsheet control, and 2. MS Excel document) to the "to variant" function in separate trials, and connecting that function's output to the "variant to data" function.  No luck.
 
Another option is to just read hex values from an existing Excel spreadsheet into a table in the VI and working with the values from there.  I know there are examples covering this topic, but if anyone has a SIMPLE example or some advice, it would be appreciated.
 
Take care. 
0 Kudos
Message 3 of 12
(3,456 Views)
Why can you not do it this way.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 4 of 12
(3,451 Views)
That method is similar to what I already have working (just entering values in a table, converting hex strings to numbers, and sending them to the dll).  However, the user is entering a long script into this table (or in your case, the array), and if he/she wants to cut or copy and paste a portion of the script, it doesn't work.  You have to cut or copy one cell at a time.  If the user wants to enter just one new line in middle of what she has already entered, she basically has to start all over from that line.  Working with an Excel spreadsheet is much easier and more user-friendly.
0 Kudos
Message 5 of 12
(3,443 Views)
I think the MSoffice spreadsheet control is teh way to go. I can get the value out of the first cell, but haven't figured out how to read other cells.
0 Kudos
Message 6 of 12
(3,437 Views)
Here is a way to read the values from the MSOffice spreadsheet 9.0 control. The values are read into a text array. There could be a much easier method.
Message 7 of 12
(3,432 Views)

awesome.  I think that will work great...and I never would have gotten it on my own (i'm new to LV). 

Thanks.  You got a good rating for that reply.

0 Kudos
Message 8 of 12
(3,426 Views)

Hello again...

One problem/question.  The "properties" used to get the number of rows and columns in the spreadsheet are simply giving the number of rows/columns visible on the screen.  In order to be useful for scripts of varying sizes, we need to know the number of rows/columns that are actually used.  Is there any way to do that here?  We could either use the number of rows/columns with data in them, or is there a way to count the number that are highlighted by the cursor, if nothing else?

Have a good one.

0 Kudos
Message 9 of 12
(3,407 Views)

NEVERMIND.

sorry.  i got it...just had to find the right property to use.

0 Kudos
Message 10 of 12
(3,403 Views)