You check if workbooks is NULL pointer. As a rule of thumb, you may want to check if excel is null pointer before using it.
QAxObject* excel = new QAxObject( “Excel.Application”, 0 );
if ( excel )
{
QAxObject* workbooks = excel->querySubObject( “Workbooks” );
if ( workbooks )
{
QAxObject* workBook = workbooks->querySubObject("Open(const QString&)", path);
QAxObject* sheets = workBook->querySubObject( "Worksheets" );
QAxObject* sheet1 = sheets->querySubObject( "Item( int )", 1 );
QAxObject* sheet2 = sheets->querySubObject( "Item( int )", 2 );
...