Hi,
I am using an excel vba macro to get data from others excel files through an adodb connection.
There are different source files containing extacly the same kind of data (same column type, same number of column etc), just the number of rows in each file is different.
The vba macro works just fine for every source file with less than 32570 rows and doesnt work when the source file has 34638 rows or more.
I didn't check precisely but my guess is that it doesn't work if the source file a more than 2^15 = 32768 rows
Here is my code:
When the code bug, Excel freezes and I have to stop it with windows task manager (end task)
It freeze while executing: rs.Open ("select max(DATE) from [TMP_PARExport]"), cn
I have tried different SQL requests and it also bugs..
Any help appreciated,
cheers
I am using an excel vba macro to get data from others excel files through an adodb connection.
There are different source files containing extacly the same kind of data (same column type, same number of column etc), just the number of rows in each file is different.
The vba macro works just fine for every source file with less than 32570 rows and doesnt work when the source file has 34638 rows or more.
I didn't check precisely but my guess is that it doesn't work if the source file a more than 2^15 = 32768 rows
Here is my code:
Code:
Dim source As String
source = "W:\Usr\Pagode\HistoParam\" & stock & "_Ech.xls"
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=" & source & ";Extended Properties=Excel 12.0 Xml;"
.Open
End With
Set rs = New ADODB.Recordset
rs.Open ("select max(DATE) from [TMP_PARExport]"), cn
When the code bug, Excel freezes and I have to stop it with windows task manager (end task)
It freeze while executing: rs.Open ("select max(DATE) from [TMP_PARExport]"), cn
I have tried different SQL requests and it also bugs..
Any help appreciated,
cheers