-
Does anybody out there know how I can import the contents of an ADO recordset into an excell worksheet. There is a CopyFromRecordset method but it only supports DAO recordsets (Excel 97 dont know about 2000). I will step through the recordset and insert each row individually but I cannot even find out how to insert a string into a cell????
-
to put a string in a cell use
Sheet1.cells(row, col) = "my text"
-
Look up the 'GetRows' method in the ADO documentation. It allows you to assign the contents of an entire recordset to something else (like an array, etc.)
I haven't tried this with Excel, but it should go something like this:
Worksheets("Sheet1").Range("A1") = RS.GetRows(X)
Where X is the number of rows you want to retrieve from your recordset. This would assign the contents of your recordset to the Range beginning at cell A1.