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