QAxObject *excel = new QAxObject( "Excel.Application", 0 );
QAxObject * workbooks = excel->querySubObject("WorkBooks");
workbooks->dynamicCall("Open (const QString&)", fileName);
QAxObject * workbook = excel->querySubObject("ActiveWorkBook");
QAxObject * worksheets = workbook->querySubObject("WorkSheets");
执行到最后一句时出现
QAxBase: Error calling IDispatch member WorkSheets: Unknown error
之前成功了的,好像是因为我把office更新到了2013?所以不叫WorkSheets了?
------解决方案--------------------
用excel新建一个宏,然后从中去找这些名字吧