02-03-2021 08:35 AM
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
02-03-2021 10:03 AM
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.
02-03-2021 10:38 AM
Does this help?