Page 1 of 1

Not able to open existing excel file

Posted: Mon Nov 03, 2008 2:15 pm
by vsp
Canany help me providing small codo snippet for opening existing excel file and read the data.

I have gone thru all the forums. But not able to open the excel file by providing its name. Of course I might not be using right call.


wxAutomationObject excelObj;
wxString docPath = "C:\\testexcel.xlsx";
excelObj.CreateInstance("Excel.Application");
excelObj.PutProperty("Visible","1");
excelObj.CallMethod("Documents.Open, docPath);
Thanks.

Posted: Mon Nov 03, 2008 5:51 pm
by timg
I think you need to use a different method for Excel:

Code: Select all

excelObj.CallMethod("Workbooks.Open, docPath);
I didn't try it, but it should work.

Posted: Tue Nov 04, 2008 5:13 am
by vsp
Thanks it works fine.