![]() ![]() The array is then transposed so that records are in the first dimension (in rows), and fields are in the second dimension (in columns). However, if Excel 97 or earlier is detected, the recordset is first copied to an array using the GetRows method of the ADO recordset object. If Excel 2000 or 2002 is detected, the CopyFromRecordset method is used because it is efficient and requires less code. The code first checks the version of Excel. The code sample provided below shows how to copy an ADO recordset to a Microsoft Excel worksheet using automation from Microsoft Visual Basic. The sample code presented illustrates how you can transfer an ADO recordset to Excel 97, Excel 2000, Excel 2002, Excel 2003, or Excel 2007. To transfer an ADO recordset to Excel 97, you can create an array from the recordset and then populate a range with the contents of that array. However, CopyFromRecordset in Excel 97 supports only DAO recordsets. CopyFromRecordset in Excel 20 can be used to copy either a DAO or an ADO recordset. Excel 97, Excel 2000, and Excel 2002 have a CopyFromRecordset method that you can use to transfer a recordset to a range. The approach that you can use depends on the version of Excel you are automating. You can transfer the contents of an ADO recordset to a Microsoft Excel worksheet by automating Excel.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |