Using CopyFromRecordset to Fill a Spreadsheet with data from a DAO Recordset
Posted on 2003-11-11
I´m trying to fill a spreadsheet (the activex control, I'm using Microsoft Office Spreadsheet 10.0) with data I'm retrieving from a query.
I want to use the CopyFromRecordset method. The documentation says de it can be used with ADO and DAO recordsets. It works fine with ADO recordsets, but I get an error message when i try to use with DAO recordset. The message is something like
"Error '430' in execution time: This class does not admit Automatization or does not admit the expected interface".
The code I'm using is:
Dim res As DAO.Recordset
Set res = CurrentDb.OpenRecordset(sql)
disponibilidad = res.GetRows(res.RecordCount)
nPersonas = UBound(disponibilidad, 2) + 1
.ScreenUpdating = False
.ActiveSheet.Range("A1").EntireRow.Hidden = False
.TitleBar.interior.Color = "Grey"
.Cells.Font.Name = "Tahoma"
That's it... What can I do?