|
本帖最后由 gtxing 于 2016-8-11 20:25 编辑
我的Excel版本是2016版的,使用VBA调用sql语句时只select出来65536行数据,其它都没select出来,这是要设置下哪了吗?
求大神帮忙解决下,谢谢
- Sub 查询()
- Dim cnn As Object, sql$
- Set cnn = CreateObject("adodb.connection")
- cnn.Open "Provider = Microsoft.ACE.Oledb.12.0;Extended Properties=excel 12.0;Data Source =" & ThisWorkbook.FullName
- sql = "select md,dq from [Sheet1$A:B]"
- Sheets("Sheet1").[H1].CopyFromRecordset cnn.Execute(sql)
- cnn.Close
- Set cnn = Nothing
- End Sub
复制代码
file:///C:\Users\Administrator\AppData\Roaming\Tencent\Users\2656483923\QQ\WinTemp\RichOle\D6OKSUPOKCSMQ_B1Q(820QO.png
|
|