我正在尝试使用VBA查询电子表格,并且正在遇到看似难以限制的65536行(尽管我正在运行Excel 2013).基本上,当尝试选择行数大于65536的所有行时,我收到以下错误消息:
运行时错误'-2147217865(80040e37)':
Microsoft Access数据库引擎找不到对象'Sheet1 $ A1:A65537'.....
我的代码如下:
Option Explicit
Sub ExcelQuery()
Dim conXLS As ADODB.Connection
Dim rsXLS As ADODB.Recordset
Dim strPath As String
Dim strSQL As String
Dim i As Integer
'Get the full directory + file name location of the current workbook (so it can query itself)'
strPath = Application.ActiveWorkbook.FullName
'create the ADO connection to the excel file'
Set conXLS = New ADODB.Connection
With conXLS
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=" & strPath & ";" & _ …Run Code Online (Sandbox Code Playgroud)