Share via


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)

Syntax

'Declaration
Function CopyFromRecordset ( _
    Data As Object, _
    MaxRows As Object, _
    MaxColumns As Object _
) As Integer
int CopyFromRecordset(
    Object Data,
    Object MaxRows,
    Object MaxColumns
)

Parameters

  • 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

Remarks

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.

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace