New
#1
"The server threw an exception error" when running Excel-to-CSV.Vbs
Hi,
new to the forum, I am encountering an issue that is driving me mad I cannot find a solution anywhere to fix it.
I am running this script below from cmd prompt calling it with this command line: Excel-to-Csv.vbs test.xlsx test.csv (where test.xlsx is a NON-empty .xlsx file and test.csv is expected to be the output file, i.e. it is a conversion of a file from .xlsx to .csv).
-----------------------------------------------------
if WScript.Arguments.Count < 2 Then
WScript.Echo "Please specify the source and the destination files. Usage: ExcelToCsv <xls/xlsx source file> <csv destination file>"
Wscript.Quit
End If
csv_format = 6
Set objFSO = CreateObject("Scripting.FileSystemObject")
src_file = objFSO.GetAbsolutePathName(Wscript.Arguments.Item(0))
dest_file = objFSO.GetAbsolutePathName(WScript.Arguments.Item(1))
Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(src_file)
oBook.SaveAs dest_file, csv_format
oBook.Close False
oExcel.Quit
-----------------------------------------------
I have Excel 2007 installed on a Windows 7 Home edition - 64 bit PC.
As I said, the script (used to) simply converts a .xlsx/.xls file to a .csv file, but recently it stopped working
and when I run the script, I get this error message as seen in image below, I cannot understand why it comes out.
Any idea how to fix this?
Line: 17
Char: 1
Error:The server threw an exception
Code: 80010105
Source: (null)
Here is a screenshot of the error:
Last edited by JohnSmithWin7; 25 Jan 2017 at 06:24.