Hi all, I got xlsm file format and I defined a table with name range.
I can get the table name, but I didn't succeed to recive his ranges I tried this code

Qt Code:
  1. QAxObject* _excel = new QAxObject( "Excel.Application", 0 );
  2. QAxObject* workbooks = _excel->querySubObject( "Workbooks" );
  3. QAxObject* workbook = workbooks->querySubObject( "Open(const QString&)", fileName );
  4. QAxObject* sheets = workbook->querySubObject( "Worksheets" );
  5. //worksheets count
  6. int count = sheets->dynamicCall("Count()").toInt();
  7. count = sheets->property("Count").toInt();
  8. for (int i=1; i <= count; i++) //cycle through sheets
  9. {
  10. //sheet pointer
  11. QAxObject* sheet = sheets->querySubObject( "Item( int )", i );
  12. QString s_name = sheet->dynamicCall("Name()").toString();
  13. QAxObject* tables = sheet->querySubObject("Names");
  14. int table_count = tables->dynamicCall("Count()").toInt();
  15. table_count = tables->property("Count").toInt();
  16. qDebug("sheet name :%s",s_name.toAscii().constData());
  17. for (int j=1; j <= table_count; j++) //cycle through tables
  18. {
  19. QAxObject* table = tables->querySubObject( "Item( int )", j );
  20. QString t_name = table->dynamicCall("Name()").toString();
  21. qDebug("\ttable[%d]: %s",j,t_name.toAscii().constData());
  22. QAxObject * usedrange = table->querySubObject("UsedRange");
  23. QAxObject * rows = usedrange->querySubObject("Rows");
  24. QAxObject * columns = usedrange->querySubObject("Columns");
  25. int intRowStart = usedrange->property("Row").toInt();
  26. int intColStart = usedrange->property("Column").toInt();
  27. int intCols = columns->property("Count").toInt();
  28. int intRows = rows->property("Count").toInt();
  29. qDebug("\t\t[ Cells(C%d:C%d) , Rows(R%d:R%d) ]",
  30. intColStart,intCols,intRowStart,intRows);
  31. }
  32. }
  33. _excel->setProperty("DisplayAlerts", 0); //remove alert when close the file
  34. workbook->dynamicCall("Close()");
  35. _excel->dynamicCall("Quit()");
To copy to clipboard, switch view to plain text mode 

Got the error:
QAxBase::dynamicCallHelper: UsedRange: No such property in [unknown]
Candidates are:
Help!