Hi Everyone,
I created an excel instance by using wxAutomationObject.I am trying to read data from a particular Sheet(with a specific name) in an existing excel file.
Now How can i get the sheet names???And How can i get the Number of sheets present in an excel?
Thank You in Advance.
Excel Automation Topic is solved
Can't help at the moment on how to get the names of the sheets, but to get the number of sheets you can use this:
assuming appo is a wxVariant and xlbook is a wxAutomationObject containing the active workbook.
Code: Select all
appo=xlbook.GetProperty("Sheets.Count");
To get the sheet names, you can use this:
Just scan through how ever many sheets are returned from the Sheets.Count
Code: Select all
rng[0] = wxVariant((long) 3);
res = xlbook.GetObject(xltmp1, "WorkSheets", 1, rng);
appo = xltmp1.GetProperty("Name");