VB把excel数据导入ACCESS

前端之家收集整理的这篇文章主要介绍了VB把excel数据导入ACCESS前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Dim sql As String

Dim conn As ADODB.Connection

Set conn = New ADODB.Connection

Dim Constr As String

Constr = "PROVIDER = Microsoft.Jet.OLEDB.4.0;" & "Data Source=c:\db.mdb"

conn.Open Constr

sql = "select * into t2 from [excel 8.0;database=c:\book1.xls].[sheet1$]"

conn.Execute sql

conn.Close

Set conn = Nothing

http://www.cnblogs.com/wsoft/articles/1960028.html
xls文件到mdb,用AutoHotkey实现如下:
conn:=ComObjCreate("ADODB.connection")
connectionStrings:="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="A_ScriptDir"\test\TestDB.mdb"
conn.Open(connectionStrings)
sql:="Select*INTOtest4FROM[Excel8.0;HDR=Yes;IMEX=1;DATABASE=X:\AHK\CSV\test.xls].[Sheet1$];"
conn.execute(sql)
conn.Close
conn:=
return
建议用
Microsoft.ACE.OLEDB.12.0 代替Microsoft.Jet.OLEDB.4.0
用Excel 12.0 Xml; 代替Excel8.0;
原文链接:https://www.f2er.com/vb/257150.html

猜你在找的VB相关文章