LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error code -2146827284 when trying to programmatically assign X and Y values to an excel chart series

I am trying to export data to an excel spreadsheet from Labview 6.1 using Activex Automation, then plot a chart in excel using this data. I can successfully move the data and can build the chart, but I can only assign one of the data axis (either the XValues, or the Values (ie Y values) property of the class, depending which I set first). I get a message "Exception occured in Microsoft Excel, Unable to set the Values property of the Series class." with an error code of -2146827284. See example code in case I have done anything stupid. Anyone got any ideas?
0 Kudos
Message 1 of 8
(4,534 Views)
Hello Gavin,

You are probably getting this error because you are trying to access cells outside the maximum range in Excel. A Microsoft Excel spreadsheet is limited to 256 columns and 65,536 rows. This Knowledge Base has further information.

If you are interested in a more robust data tool for managing, inspecting, analyzing and reporting test Data, check out DIAdem. It can handle data sets with over 1 billion values.

If none of these suggestions help, or if I�m not correctly understanding your issue, please post the software and versions you are using, the applicable portions of your code, a
nd any other information that may help, and I�ll be happy to look further into it.

Have a nice day!

Robert M
Applications Engineer
National Instruments
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 2 of 8
(4,534 Views)
Robert, thanks for responding. I was aware of the excel size limits but I don't think this is the issue here. The code I attached before tries to set first "XValues" to A2:A5 and then "Values" to c2:c5 (well within the range of excel I think 😉 ). I have attached this again and also added an image of the diagram with probes on the key places. It always succeeds on the first "set" function, and then fails on the next one. Just to confuse things it works fine if I set the "XValues" and "Values" to an array of integers. I am running Labview 6.1 on windows XP with Office XP installed as well.

Gavin
Download All
0 Kudos
Message 3 of 8
(4,534 Views)
Gavin,

It appears the code you attached this last time is significantly different from what you attached before. In your �Create Chart� subVI, after wiring Range.Cell2 to Cell2, it seemed to run without errors. When you make that change and run it, does the chart appear as you want it?

Have a nice day!

Robert M
Applications Engineer
National Instruments
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 4 of 8
(4,534 Views)
Robert,

a thousand apologies for wasting your time on that one. I actually attached the wrong file there. The file was (basically) one of your (as in NI) example programs. Hopefully I have now attached the correct below (the one I used for generating the jpg in the previous comment).

Thanks for your persistence!

Gavin
0 Kudos
Message 5 of 8
(4,534 Views)
Gavin,

I can give you a few suggestions, but it looks like this is an Excel error, and not a LabVIEW issue. msdn.microsoft.com has some excellent resources for the ActiveX controls for Excel.

Are you using this vi as a subVI of a larger program? In the code you gave me, the cells you reference, A2:A4 and C2:C4, appear to be from a new sheet you call temp, and are empty. Maybe XValues only takes a range of cells with values. You�ll have to look that up.

One discrepancy I noticed, which you may already know about, is how you reference both the �range� invoke nodes. You send �A2:A4� and �C2:C4� to cell1, and nothing to cell2. Do you need to send A2 to cell1 and A4 to cell2? When changing this, I still get the same erro
r, but that may be because all those cells are empty.

If you do a lot of Word and Excel report generation, you may be interested in the LabVIEW Report Generation Toolkit for Microsoft Office.

Let me know if nothing here helps, and I�ll see what else I can find out. Have a nice day!

Robert M
Applications Engineer
National Instruments
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 6 of 8
(4,534 Views)
Robert, thanks for your suggestions. It looks like the problem was indeed that there was no data in those cells. Since I could set one range successfully on blank data I assumed that was the case generically. Obviously not, and I can't see that documented anywhere. Never mind, I think I have it beaten now. Thanks for all your help,
Gavin
0 Kudos
Message 7 of 8
(4,534 Views)
Hi,
This is what I used and it seems to work. But I have an extra series in there for some reason.
Good luck
0 Kudos
Message 8 of 8
(4,534 Views)