用DATA控件读取Excel时产生数值字段溢出错误,并且错误也没有规律可循,24这样的值也报溢出,单元格格式设为文本或数值或常规都试过了,不管用。用ACCESS链接这个EXCEL表,打开这个表查看,发现代码不能读取的地方,被替换成了这种东西:#数字!。好象是JET引擎根本就读不出。代码如下:
datXls.Connect = "Excel 8.0;"
datXls.DatabaseName = txtFile.Text
datXls.RecordsetType = 1
datXls.RecordSource = "Select * from [Sheet1$]"
datXls.Refresh
Dim i As Integer
With datXls.Recordset
While Not .EOF
For i = 0 To .Fields.Count - 1
Debug.Print .Fields(i).Name & vbTab & .Fields(i).Value
Next
.MoveNext
Wend
.Close
End With
datXls.Connect = "Excel 8.0;"
datXls.DatabaseName = txtFile.Text
datXls.RecordsetType = 1
datXls.RecordSource = "Select * from [Sheet1$]"
datXls.Refresh
Dim i As Integer
With datXls.Recordset
While Not .EOF
For i = 0 To .Fields.Count - 1
Debug.Print .Fields(i).Name & vbTab & .Fields(i).Value
Next
.MoveNext
Wend
.Close
End With
firstly,the problem cells are not "calculated cells";secondly,I try it by ADO connection,but find it can not work correcttly,the ADO Connection String is incorrect,and I do not want to use ODBC Connection.What I can do next?
Do you mind give me your EMAIL so I can send the problem EXCEL file to you?