LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Limit size of tables in excel

Solved!
Go to solution

Hi everyone, i'm trying to export a table to excel and I'm having some trouble.

 

First, I used "Write To Spreadsheet File.vi" to create a .xls file, and that worked perfectly, but now I need to export another table to a different sheet of the same xls file (whose name we should be able to choose), so I've begun to use the ActiveX controls.

 

I can create the new sheet with the name desired, and write the data into it, but the problem is that it doesn't show only my table, but also ALL of the cells (65536 x VI) with the value #N/A.

 

I can solve the problem in one of the dimensions, but not in both of them. It's the first time I use the ActiveX functions (I've built this VI with the help of other examples I've found in the forum), so I think I'm missing something important.

 

What can I do to show ONLY my table?

 

Thanks a lot for your time and knowledge.

 

 

0 Kudos
Message 1 of 8
(6,318 Views)

It's because you define your range as 1:2 which is row 1 and row 2. So the whole rows are selected that's why you get #N/A in the cells with no values. Keeping your range to the table dimension will get ris of the error.

 

Ben64

0 Kudos
Message 2 of 8
(6,303 Views)
Solution
Accepted by topic author arubio10

Also, you are closing twice the _Workbook reference thus generating an error. Here's how to do it. The Row Col To Range Format.vi was taken from here.

 

Ben64

 

excelTable.png

 

 

Message 3 of 8
(6,296 Views)

Thank you very much ben64, now I understand better how the ActiveX works (specially the "Cell1" and "Cell2" properties of "Range"), and the program does exactly what I wanted it to do.

 

Now I added a few things just to close and save without showing the Excel window (the "workbook close" and "application quit" nodes, and the FALSE value to the "visible" entry of the "OPEN EXCEL" block ), but what I get by doing what you can see in the attached picture is Excel fastly opening and closing in less than a second... Any idea of how to do it without seeing the Excel window?

 

Thanks again

 

Arubio10

0 Kudos
Message 4 of 8
(6,283 Views)

If you have report generation toolkit installed along with your labview.

then it will give much flexibility to write data into excel file. also you can do some analysis of the data.

 

 

Regards
Prabhakant Patil
0 Kudos
Message 5 of 8
(6,279 Views)

That's the problem, Prabhakant Patil, we don't have it at the moment (they're planning to buy it for newer versions of LabVIEW, but for now I have to use ActiveX).

 

Thanks

 

Arubio10

0 Kudos
Message 6 of 8
(6,277 Views)

To work with Excel you don't have the choice but to open the application. To minimize the effect you can use the attached modified Open Excel vi where you can set the window state. If you set it to xlMinimized you will not see the Excel window.

 

Ben64

 

Open_Excel_BD.png

Message 7 of 8
(6,260 Views)

Thanks ben64, that should work  Smiley Happy

0 Kudos
Message 8 of 8
(6,246 Views)