我在文件夾中有幾個「.xls」文件,需要將其轉換爲製表符分隔值 找到了一個用於此的vb腳本..請使用某些主體sugest如何執行此操作? 我得到幾個錯誤時運行this.I我不是一個VB programmer.Experts ......請幫助將xls文件轉換爲製表符分隔文件的異常
Public Sub Main()
Dim WScript As Object = Nothing '' with out nothing it was showing an error
Dim oExcel As Object
Dim oBook As Object
If WScript.Arguments.Count < 2 Then
WScript.Echo("Error! Please specify the source path and the destination. Usage: XlsToCsv SourcePath.xls Destination.csv")
Wscript.Quit()
End If
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Open(WScript.Arguments.Item(0)) ''item o might be excel
oBook = oExcel.Workbooks.Open("C:\Users\5A5.xls")
oBook.SaveAs(WScript.Arguments.Item(1), -4158)
oBook.Close(False)
oExcel.Quit()
WScript.Echo("Done")
End Sub
例外:
System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation.
---> System.NullReferenceException: Object variable or With block variable not set.
你可能已經至少表明,這些「錯誤」 ...:P – AKDADEVIL
錯誤:System.Reflection.TargetInvocationException:異常已通過調用的目標引發異常。 ---> System.NullReferenceException:對象變量或未設置塊變量。 – user1254579