![]() |
#2
ZHRXJR2020-10-07 19:16
回复 楼主 zfy568
|
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,还是报相同的错误
只有本站会员才能查看附件,请 登录