PDA

Click to See Complete Forum and Search --> : VB5.0 and Excell----URGENT PLEASE


SteFlitII
Jan 12th, 2000, 08:44 PM
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????

ejwipp
Jan 13th, 2000, 01:18 AM
to put a string in a cell use

Sheet1.cells(row, col) = "my text"

Brent Akester
Jan 13th, 2000, 03:43 AM
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.