用VB6.0做了一个导出EXCEL的代码,有点小问题
VB引用一下“Microsoft Excel 11.0 Object Library”导出效果可以看代码(不要直接成生EXCEL文件的代码),在运行导出数据时如果用鼠标“点住不放”EXCEL表中下面的滚动条后导出速度明显加快,不然大数据时导出速度有点慢,请高手帮助修改一下代码,谢谢。
代码如下:
Private Sub Command1_Click()
Dim excelApp As Excel.Application
Set excelApp = New Excel.Application
If excelApp Is Nothing Then
Set excelApp = CreateObject("Excel.application")
If excelApp Is Nothing Then
Exit Sub
End If
End If
excelApp.Visible = True
Me.MousePointer = vbHourglass
excelApp.Workbooks.Add
With excelApp.ActiveSheet
Dim i As Integer, j As Integer
For i = 1 To 200
For j = 1 To 10
.Cells(i, j) = j
Next j
.Rows(i + 1).Select
DoEvents
Next i
.Cells.EntireColumn.AutoFit
End With
Me.MousePointer = vbDefault
Set excelApp = Nothing
End Sub
[ 本帖最后由 jzhandly 于 2012-12-10 21:48 编辑 ]