restricting to specified index

I am doing project in vc++ 2005 in which i have to import excel sheet but the tool is crashing when i try to import more than 30 rows and more than 5 columns.
the code is:

CFileDialog ImportFileDlg(TRUE, L"*.xls", L"*.xls", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
L"Report File(*.xls)| *.xls|");

COleSafeArray VrData;
long index[2];
VARIANT VrVal;

VrData.GetUBound(DEF_1, &m_lNumRows);
VrData.GetUBound(DEF_2, &m_lNumCols);
for(nRow = DEF_1; nRow <= m_lNumRows; nRow++)
{
for(nCol = DEF_1; nCol <= m_lNumCols; nCol++)
{
index[DEF_0] = nRow;
index[DEF_1] = nCol;
VrData.GetElement(index, &VrVal);
}}




// crashing here if m_lNumRows> 31 and m_lNumColsl>5
please give me solution
Last edited on
That pretty much says nothing. Specifically:
1. you haven't shown the definitions or declarations of the relevant symbols
2. we don't know about the format of the spreadsheet and the type of the column that you're reading, you ought to cater for the format but you dont
3. It's not clear what you've done to breach that 30x5 limit
Topic archived. No new replies allowed.