+ if (!excelObject.GetInstance(_T("Excel.Application")))
+ {
+ // Start Excel if it is not running
+ if (!excelObject.CreateInstance(_T("Excel.Application")))
+ {
+ wxMessageBox(_T("Could not create Excel object."));
+ return;
+ }
+ }
+
+ // Ensure that Excel is visible
+ if (!excelObject.PutProperty(_T("Visible"), true))
+ {
+ wxMessageBox(_T("Could not make Excel object visible"));
+ }
+ const wxVariant workbooksCountVariant = excelObject.GetProperty(_T("Workbooks.Count"));
+ if (workbooksCountVariant.IsNull())