有没有哪位同志能够写出用VB把excel导入Access,同时用进度条显示导入进度的代码
如果能有具体的思路或者相关的解释就更好了,谢谢!!!
... Set connXLS = New ADODB.Connection 'connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & strExcel & "';Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";" connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & strExcel & "';Extended Properties=""Excel 12.0;HDR=NO"";" '由于我用的是office2007的excel,所以要用ACE而不是Jet。 connXLS.Open connStr Set rsXLS = New ADODB.Recordset sqlStr = "select * from [Sheet1$]" 'Excel工作簿名称 +$ rsXLS.Open sqlStr, connXLS, adOpenKeyset, adLockOptimistic if rsXLS.RecordCount =0 then '没有记录 err.raise ERROR_USER,"没有记录" end if '遍历所有记录、所有字段 for i = 0 to rsXLS.RecordCount -1 for j = 0 to rsXLS.Fields.Count-1 debug.print rsXLS(j) next rsXLS.MoveNext next rsXLS.Close ...