Solved the problem myself... in case anybody needs to know:
//open file
QAxObject *workbooks
= excel
->querySubObject
( "Workbooks" );
QAxObject *workbook
= workbooks
->querySubObject
( "Open(const QString&)",
"test.xlsm" );
// write data
QAxObject * range
= worksheet
->querySubObject
("Range(C10)");
range
->setProperty
("Value",
QVariant(7));
//DATA TO BE WRITTEN=7
// update the whole workbook
workbook->dynamicCall("RefreshAll()");
// read data
qDebug() << "Alter Wert: " << range->property("Value").toInt();
//close excel (silently)
workbook->dynamicCall("Close (Boolean)", false);
excel->dynamicCall( "Quit()");
QAxObject* excel = new QAxObject( "Excel.Application", 0 );
//open file
QAxObject *workbooks = excel->querySubObject( "Workbooks" );
QAxObject *workbook = workbooks->querySubObject( "Open(const QString&)", "test.xlsm" );
// write data
QAxObject * range = worksheet->querySubObject("Range(C10)");
range->setProperty("Value", QVariant(7));//DATA TO BE WRITTEN=7
// update the whole workbook
workbook->dynamicCall("RefreshAll()");
// read data
qDebug() << "Alter Wert: " << range->property("Value").toInt();
//close excel (silently)
workbook->dynamicCall("Close (Boolean)", false);
excel->dynamicCall( "Quit()");
To copy to clipboard, switch view to plain text mode
Bookmarks