This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Copies the contents of an ADO or DAO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range. If the Recordset object contains fields with OLE objects in them, this method fails.
expression.CopyFromRecordset(Data, MaxRows, MaxColumns)
expression Required. An expression that returns a Range object.
Data Required Variant. The name of the Recordset object to copy into the range.
MaxRows Optional Variant. The maximum number of records to copy onto the worksheet. If this argument is omitted, all the records in the Recordset object are copied.
MaxColumns Optional Variant. The maximum number of fields to copy onto the worksheet. If this argument is omitted, all the fields in the Recordset object are copied.
Copying begins at the current row of the Recordset object. After copying is completed, the EOF property of the Recordset object is True.
When this method copies the recordset to the worksheet, the results will be truncated if you do not specify a range that is large enough to hold the contents of the recordset.
This example copies a recordset named rstAuthors into the active sheet of Spreadsheet1 starting at cell A1.