We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

NamedRange.CopyFromRecordset Method

Copies the contents of an ADO or DAO recordset into a worksheet, beginning at the upper-left corner of the NamedRange control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

int CopyFromRecordset(
	Object Data,
	Object MaxRows,
	Object MaxColumns
)

Parameters

Data
Type: System.Object
The recordset to copy into the range.
MaxRows
Type: System.Object
The maximum number of records to copy into the worksheet. If this argument is omitted, all the records in the recordset object are copied.
MaxColumns
Type: System.Object
The maximum number of fields to copy into the worksheet. If this argument is omitted, all the fields in the recordset object are copied.

Return Value

Type: System.Int32

If the recordset contains fields with OLE objects in them, this method fails.

Copying begins at the current row of the recordset. After copying is completed, the EOF property of the recordset object is true.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Show: