CopyFromRecordset Question
parityd wrote:
Below is the code segment that makes multiple xl sheets.
Using Excel's CopyFromRecordset on a recordset with more records than
the 65536 maximum worksheet rows does not cause the method to fail.
Rather, the cursor is merely moved e.g. to record 65537. Therefore, you
could do something like this:
Sub more_than_65536()
Dim rs As Object
Set rs = CreateObject("ADOR.Recordset")
rs.Open _
"SELECT * FROM 100K_row_table;", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Tempo\New_Jet_DB.mdb"
Dim Counter As Long
With Workbooks("MyWorkbook.xls")
Do While Not rs.EOF
Counter = Counter + 1
.Worksheets(Counter).Range("A1") _
.CopyFromRecordset rs
Loop
End With
End Sub
Jamie.
--
|