編輯

共用方式為


Range.CopyFromRecordset(Object, Object, Object) Method

Definition

Copies the contents of an ADO or DAO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range.

public int CopyFromRecordset (object Data, object MaxRows, object MaxColumns);
Public Function CopyFromRecordset (Data As Object, Optional MaxRows As Object, Optional MaxColumns As Object) As Integer

Parameters

Data
Object

Required Object. The Recordset object to copy into the range.

MaxRows
Object

Optional Object. 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
Object

Optional Object. The maximum number of fields to copy onto the worksheet. If this argument is omitted, all the fields in the Recordset object are copied.

Returns

Remarks

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

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

Applies to