vb6寫入excel以前是正常的,現在換服務器了,報實時錯誤48,加載DLL錯誤
Dim xls As New Excel.Application
Dim oBook As New Excel.Workbook
Dim oSheet As New Excel.Worksheet
Dim fs As New Scripting.FileSystemObject
Dim i, j As Integer
Dim aTemp1() As String
Dim aTemp2() As String
Dim aTemp3() As String
Dim strSql As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim aFieldName() As String
'創建檔案
If IsNull(strPath) Or strPath = "" Then
funWriteExcelData = False
Exit Function
End If
aFieldName() = Split(strFieldName, ",")
aTemp1() = Split(strData, "$")
aTemp3() = Split(aTemp1(0), "#")
ReDim aTemp2(UBound(aTemp1), UBound(aTemp3)) As String
For i = 0 To UBound(aTemp1) - 1
aTemp3() = Split(aTemp1(i), "#")
For j = 0 To UBound(aTemp3)
aTemp2(i, j) = aTemp3(j)
Next
Next
If CheckFile(strPath) = False Then
xls.Workbooks.Add
xls.DisplayAlerts = False
xls.Workbooks(1).SaveAs strPath
xls.Workbooks(1).Close
End If
除錯后發現在xls.Workbooks.Add處報錯,裝了不同版本的office,還是報相同的錯誤
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/155320.html
標籤:VB基礎類
上一篇:CEDITVIEW文本保存問題
