Populating Excel cells with VBA/ADO

Is it possible to use an ADO Recordset to populate an Excel spreadsheet with data from an external database source (ie. Oracle)?
If so, does anyone have some example code that shows how to read the Recordset and populate specific cells?
GeekManAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
dhwanilshahConnect With a Mentor Commented:
This example copies the field names from a DAO Recordset object into the first row of a worksheet and formats the names as bold. The example then copies the recordset onto the worksheet, beginning at cell A2.

For iCols = 0 to rs.Fields.Count - 1
    ws.Cells(1, iCols + 1).Value = rs.Fields(iCols).Name
Next
ws.Range(ws.Cells(1, 1),  _
    ws.Cells(1, rs.Fields.Count)).Font.Bold = True
ws.Range("A2").CopyFromRecordset rs
0
 
manojaminCommented:
read this,

http://support.microsoft.com/support/kb/articles/Q112/4/17.asp 

and use this,

ExcelSheet.Cells(row, col).Value = youradors("yourfiled")


0
 
GeekManAuthor Commented:
manojamin,dhwanilshah...
Thanks for your help.
0
All Courses

From novice to tech pro — start learning today.