LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read back sheet names in excel workbook

Solved!
Go to solution

I'm trying to build a vi to organize my data in Excel workbooks.

There are available ActiveX controls to communicate with MS Office, but I couldn't find any usable help and detailed explanation of controls, properties, arguments, commands etc.

For example, I want to do simple task- to open a workbook and read back the list of worksheets names.

 

Generally- where I can find  a help for the activeX controls? Are they part of the MSO excel activeX library (if so, where I can find info), or this is a library build by NI?

 

Or  I must browse and guess all the properties blindly until find some dodgy way>

0 Kudos
Message 1 of 12
(11,231 Views)
Look here for more. Smiley Happy
- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 2 of 12
(11,221 Views)

Here is an old stuff I made for a guy who asked a question about ActiveX and Excel (see attached screenshot). I've added a property node to show you how you can retrieve a sheet name.

 

Generally, you can have a look at some examples included when you install LabVIEW : you can search an example by name (you just need to type "ActiveX" or "Excel"). The problem with ActiveX is that it's not always well documented.

0 Kudos
Message 3 of 12
(11,220 Views)

Thanks Krzone, this is exactly the answer.

 

Also, thanks to parthabe, the link to the excel board is great help.

 

Appears the answers are more in VB and Excel forums, than in LV. Still I must find out  how to translate VB to LV... looks simple but...

 

0 Kudos
Message 4 of 12
(11,211 Views)

Dimo wrote:

 

Appears the answers are more in VB and Excel forums, than in LV.


I m afraid, there is no Excel forum/board within NI site, it is actually a Excel (repository) thread floated in the Special Interest Board Breakpoint.

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 5 of 12
(11,209 Views)

Hi Dimo

 

Once you move into ActiveX and Excel territory MSDN is a good resource for information on Excel specific methods, arguments and so on. The examples are in C#, VB or C++, but you get an idea on how to use calls in the enviroment. Hope this helps.

 

Best Regards

 

David

NISW

0 Kudos
Message 6 of 12
(11,192 Views)
Solution
Accepted by topic author Dimo

Hi Krsone,

 

Again, thanks for your example, I attached my vi doing exactly this:

 

Opens excel file, and reports a list of worksheet names found in the workbook.

 

It can be used as a subvi to open workbook/find worksheet by name and edit/modify cells etc. 

Message 7 of 12
(11,180 Views)

Thanks to both of you for posting your VIs. I wanted to do a similar thing and it made my life easy.

 

Here is a VI that returns an array of strings from a section of a sheet.

 

I found the grid to cell number VI on yet another post. don't remember where, but thanks to that person too...

 

Andrew

0 Kudos
Message 8 of 12
(9,333 Views)

I don't know why the excellent (and easy-to-use) tools in the Report Generation Toolkit are not mentioned.  Here is a little routine that returns all of the WorkSheet names.Worksheet Names.png

The first function, New Report, opens the Excel Workbook and generates an Object "wire" for it.  The While loop starts with Excel Get Worksheet, trying to get Worksheet 0, 1, ... (until it tries to get the successor to the last Worksheet, which returns an Error).  If it succeeds, it calls the Get ActiveX References, and we use the Worksheet reference to get the Worksheet Name.  Pretty straight-forward so far.  The Error case (not shown) wires a blank to the name, and a False to the Conditional Index terminal (instead of True, as is shown here).  The Name and Conditional Index values are brought to a Conditional Index terminal, which builds our Array of Names (leaving off the blank name for the final non-existant Worksheet).  We end the While loop on the Error condition, clearing the Error before exiting the loop.

 

Bob Schor

Message 9 of 12
(9,301 Views)

hi Bob, this is a really good solution, but I cannot get my labview to do a conditional index terminal like you have here. Also please post the error state to make sure I get it right. Thanks and regards. I am using Labview 2010

0 Kudos
Message 10 of 12
(6,250 Views)