下面是读取的代码
Sub CoRst()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim SQL As String
SQL = "select * from 表1"
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;data source=" & "F:\Database1.accdb"
rst.Open SQL, cnn, adOpenKeyset, adLockOptimistic
Range("A1").CopyFromRecordset rst
End Sub
你要一行分成几行纯弯可以通过将最后一句填充改为类好宴似下面的代码:
Do While Not rst.EOF
range(i,1) = rst("字做袜闷段名称1")
range(i+1,1) = rst("字段名称2")
rts.movenext
Loop