Not able to open existing excel file Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
vsp
Knows some wx things
Knows some wx things
Posts: 35
Joined: Mon Feb 21, 2005 12:52 pm

Not able to open existing excel file

Post 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.
timg
Earned some good credits
Earned some good credits
Posts: 148
Joined: Mon Jan 23, 2006 6:52 pm

Post 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.
vsp
Knows some wx things
Knows some wx things
Posts: 35
Joined: Mon Feb 21, 2005 12:52 pm

Post by vsp »

Thanks it works fine.
Post Reply