|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
通过sql在ACCESS把结果放在rs里面,rs可能包含有上千条的纪录,如果要把他们全部按照原有的格式导入一个空的EXCEL 里面,应该用什么方法最快速呢?我试过用逐个写入,但是这样速度实在太慢了!请高人不吝赐教!!
If rs.RecordCount > 0 Then
Dim xlApp As New Excel.Application
Dim xlWrsBk As Excel.Workbook
Dim xlSht As Excel.Worksheet
Set xlWrkBk = GetObject(Application.CurrentProject.path & "\Report.xls")
Set xlSht = xlWrkBk.Worksheets(1)
rowi = 2
Do Until rs.EOF
For i = 1 To rs.Fields.Count
xlSht.Cells(rowi, i) = rs(i - 1)
Next
rowi = rowi + 1
rs.MoveNext
Loop
End If |
|