Quick Recordset Copy to Excel Workbook

One of the most common things VB programmers do with Excel is load data into an Excel worksheet from a Recordset object. The method I see used most often to do this is looping through each column and row of the recordset, placing the values individually into the corresponding cells on the Excel worksheet. However, a far faster and more efficient way takes advantage of the little-known CopyFromRecordset method of the Excel Range object. All you need to use this method is an object reference to the top-left cell of the destination range. Then invoke the CopyFrom-Recordset method for this Range object, passing it the Recordset object you want to load into the worksheet. Here

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: