0

Open Excel file,Error

_ConnectionPtr m_adoConn;
_RecordsetPtr m_adoRec;
::CoInitialize(NULL);
m_adoConn.CreateInstance(__uuidof(Connection));
m_adoConn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\1.xls;Extended Properties=Excel 8.0;IMEX=1;","","",adModeUnknown);


stop this function:
inline HRESULT Connection15::Open ( _bstr_t ConnectionString, _bstr_t UserID, _bstr_t Password, long Options ) {
HRESULT _hr = raw_Open(ConnectionString, UserID, Password, Options);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}

why error
thank:)

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by fyz
0

Hi,

Maybe you should check your excel file to see if it corrupts. If so, you may try Advanced Excel Repair This tool is rather useful in salvaging damaged Excel xls files.

Alan

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.