H
hernan.rancati
Hi people,
I am trying to get access to excel selection from C++
using automation. But after getting the selection object, can't
retrieve range's values / cells. I know the Application, Workbooks
and Workbook are getting opened correctly since I can travel every
cell in the worksheets, but, still can't get the actual selection.
Following is my source code, this is getting me nuts. I know
that selection could return diferent object types but didn't found
proper documentation reggarding to it (I am trying selecting a single
cell in the excel application).
....
m_app.CreateDispatch("Excel.Application", NULL));
CWorkbooks books=m_app.get_Workbooks();
CWorkbook book = books.Open(m_filePath,
covOptional, covReadOnly, covOptional, covOptional,
covOptional, covOptional, covOptional, covOptional,
covOptional, covOptional, covOptional, covOptional,
covOptional, covOptional);
CRange range(m_app.get_Selection());
long totalHeight = range.get_height(); // >>>>>>>>>>>>> generates
exception
...
************ output *******************
First-chance exception at 0x77bd15b5 in MrChartBox2d.exe: 0xC0000005:
Access violation writing location 0x347b08ca.
****************************************
Any help will be great!
thanks to all of you, Hernan Rancati (cesare)
I am trying to get access to excel selection from C++
using automation. But after getting the selection object, can't
retrieve range's values / cells. I know the Application, Workbooks
and Workbook are getting opened correctly since I can travel every
cell in the worksheets, but, still can't get the actual selection.
Following is my source code, this is getting me nuts. I know
that selection could return diferent object types but didn't found
proper documentation reggarding to it (I am trying selecting a single
cell in the excel application).
....
m_app.CreateDispatch("Excel.Application", NULL));
CWorkbooks books=m_app.get_Workbooks();
CWorkbook book = books.Open(m_filePath,
covOptional, covReadOnly, covOptional, covOptional,
covOptional, covOptional, covOptional, covOptional,
covOptional, covOptional, covOptional, covOptional,
covOptional, covOptional);
CRange range(m_app.get_Selection());
long totalHeight = range.get_height(); // >>>>>>>>>>>>> generates
exception
...
************ output *******************
First-chance exception at 0x77bd15b5 in MrChartBox2d.exe: 0xC0000005:
Access violation writing location 0x347b08ca.
****************************************
Any help will be great!
thanks to all of you, Hernan Rancati (cesare)