LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to know how many tabs you have in an excel file

Is there a way to know how many tabs you have in an excel file you just opened?

 

I have report generation tool kit.

 

I want to add a Tab and I need to know how many tabs are in the excel file to name it.

 

So, if I have 5 tabs the new one might be blue are red depending on several factors including how many tabs the file has.

 

Open an excel file, easy.

 

Add a tab, easy.

 

Finding out how many tabs in the excel file I just opened probably easy if you know how.

Thanks for any help

Dan

0 Kudos
Message 1 of 3
(1,034 Views)

I can't check right now but you should definitely at least be able to do this by accessing the Excel Application methods. Get a reference to the Excel Application, then find the Sheets collection, then use the Count method. I might be able to dig out an example if this unclear.

 

Alternatively, I guess you should be able to do a loop using the Report Gen toolkit's Get Worksheet and keep incrementing the sheet number input until you get an error.

0 Kudos
Message 2 of 3
(1,008 Views)

Does this help?

ExcelSheetsCount.png

 

Message 3 of 3
(998 Views)