古怪问题,各路高手请进!
问题1:使用“Microsoft FlexGrid Control 6.0”控件,从数据库里面读入数据,居然在读到14000行时出现“实时错误'30006',不能为FlexGrid分配内存。”
问题2:从数据库中导出,在我机器windowsxp home版或windows2000server导出没有问题。但在windows2000professional机器上导不出来,一下子就关闭程序了。做了陷阱,也捕捉不到。不知道问题出在哪里?请高手看看。还有在某些盗版的XP下面导出的时候,出现错误报告,然后自动关闭程序了。
On Error GoTo SaveToExcel
Dim mrc As ADODB.Recordset
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim MsgText As String
Dim filename As String
Dim i As Long
Dim intCount As Long
If flagTedit Then
CommonDialog1.Filter = "excel(*.xls)|*.xls"
CommonDialog1.ShowSave
If CommonDialog1.filename = "" Then
Exit Sub
End If
filename = CommonDialog1.filename
Else
MsgBox "您还没打开传票一览窗口!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlApp.Worksheets(1)
If flagTedit Then
'显示进度窗口
frmPercent.iPerc = frmJGZPChuanPiaoShow.msgList2.Rows
For intCount = 0 To frmJGZPChuanPiaoShow.msgList2.Rows - 1
frmPercent.Show
frmPercent.lblPercent = CStr(Round(((intCount + 1) / frmJGZPChuanPiaoShow.msgList2.Rows) * 100)) & "%"
frmPercent.lblPercent.Refresh
frmPercent.PrgBar.Value = intCount + 1
For i = 1 To 24
xlSheet.Cells(intCount + 1, i).Value = frmJGZPChuanPiaoShow.msgList2.TextMatrix(intCount, i)
Next i
DoEvents
Next intCount
Unload frmPercent
'xlSheet.Range(xlSheet.Cells(1, 1), xlSheet.Cells((intCount), (i - 1))).Select
xlSheet.Columns.AutoFit
xlSheet.SaveAs filename
xlSheet.Application.Quit
Set xlBook = Nothing
Set xlSheet = Nothing
Else
MsgBox "传票一览表中没有记录,请重试!", vbOKOnly + vbExclamation, "警告"
End If