找到一个好办法,用wps的Excel软件的话,将脚本进行如下修改即可。
修改前:
Sub ExportToExcel (txt As String)
FillClipboard
Dim xl As Object
On Error Resume Next
Set xl = GetObject(,"Excel.Application")
On Error GoTo ExcelError' Enable error trapping.
If xl Is Nothing Then
Set xl = CreateObject("Excel.Application")
End If
修改后:
Sub ExportToExcel (txt As String)
FillClipboard
Dim xl As Object
On Error Resume Next
Set xl = GetObject(,"Ket.Application")
On Error GoTo ExcelError' Enable error trapping.
If xl Is Nothing Then
Set xl = CreateObject("Ket.Application")
End If
主要是将两处的 Excel.Application 替换为Ket.Application
大功告成。