我的代码是 Dim namestring As String CommonDialog1.Filter = "*.txt ¦*.txt ¦*.excel ¦*.xls" CommonDialog1.Action = 1 namestring = CommonDialog1.FileName Dim cn As New ADODB.Connection, rs As New ADODB.Recordset cn.CursorLocation = adUseClient cn.Open "

rovider=Microsoft.Jet.OLEDB.4.0

ersist Security Info=False;DataSource=namestring;Extended Properties=Excel8.0;" rs.Open "select * from [Sheet1$]", cn, adOpenDynamic, adLockOptimistic Set DataGrid1.DataSource = rs 我安装的是office2007,但我导入的文件是97--2003版的 是不是和版本有关 我不知道错在哪.请指教,谢谢
cn.Open "

rovider=Microsoft.Jet.OLEDB.4.0

ersist Security Info=False;Data Source=" & namestring & ";Extended Properties=Excel 8.0;"
回复一楼的朋友 我按你的方法改了,还是一样的错误.怎么做啊?
"

rovider=Microsoft.Jet.OLEDB.4.0

ersist Security Info=False;Data Source=" Source= 的后面被论坛多加了一个空格,要去掉啊
office97 需要引用 Microsoft DAO 3.51 Object Library office2000,2003 需要引用 Microsoft DAO 3.6 Object Library