Discussion:
saveas from excel to csv in xl2003 with semicolon
(too old to reply)
natalie
2006-06-19 14:57:55 UTC
Permalink
Hi,

can somebody help me please?

I need a solution for my script to save a excel-file to csv with
semicolon as delimiter. Since we have got Office2003 my VBScript does
not work and saves the csv-File with comma als delimiter. In Germany
the settings in the control panel are for semicolon. If I save by
myself (Data/save as/test.csv) - it's OK with semicolon.

Here my Script csv_convert.vbs:

set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open("test.xls")
oExcel.DisplayAlerts = false
oExcel.ActiveWorkbook.Worksheets(1).SaveAs "test.csv", 6
oExcel.ActiveWorkbook.Close()
oExcel.Quit()

Thank you for your help!

Natalie
Stuffin
2006-06-19 19:12:27 UTC
Permalink
Try this
ActiveWorkbook.SaveAs Filename:="C:\Download\Software Versions.csv", _
FileFormat:=xlCSV, CreateBackup:=False
Post by natalie
Hi,
can somebody help me please?
I need a solution for my script to save a excel-file to csv with
semicolon as delimiter. Since we have got Office2003 my VBScript does
not work and saves the csv-File with comma als delimiter. In Germany
the settings in the control panel are for semicolon. If I save by
myself (Data/save as/test.csv) - it's OK with semicolon.
set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open("test.xls")
oExcel.DisplayAlerts = false
oExcel.ActiveWorkbook.Worksheets(1).SaveAs "test.csv", 6
oExcel.ActiveWorkbook.Close()
oExcel.Quit()
Thank you for your help!
Natalie
natalie
2006-06-20 06:55:29 UTC
Permalink
Thank you for this idea, but with the form ":=", e.g.
FileFormat:=xlCSV, it does not work, only with

ActiveWorkbook.SaveAs Filename:="C:\Download\Software Versions.csv", 6,
False

But for my semicolon problem it does not matter ;(

another ideas's?
Post by Stuffin
Try this
ActiveWorkbook.SaveAs Filename:="C:\Download\Software Versions.csv", _
FileFormat:=xlCSV, CreateBackup:=False
Post by natalie
Hi,
can somebody help me please?
I need a solution for my script to save a excel-file to csv with
semicolon as delimiter. Since we have got Office2003 my VBScript does
not work and saves the csv-File with comma als delimiter. In Germany
the settings in the control panel are for semicolon. If I save by
myself (Data/save as/test.csv) - it's OK with semicolon.
set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open("test.xls")
oExcel.DisplayAlerts = false
oExcel.ActiveWorkbook.Worksheets(1).SaveAs "test.csv", 6
oExcel.ActiveWorkbook.Close()
oExcel.Quit()
Thank you for your help!
Natalie
ekkehard.horner
2006-06-20 12:45:27 UTC
Permalink
Post by natalie
Hi,
can somebody help me please?
I need a solution for my script to save a excel-file to csv with
semicolon as delimiter. Since we have got Office2003 my VBScript does
not work and saves the csv-File with comma als delimiter. In Germany
the settings in the control panel are for semicolon. If I save by
myself (Data/save as/test.csv) - it's OK with semicolon.
Record the "save by myself" process as a macro and check the value
of the FileFormat parameter. If it is different from 6, try the value
in your script, otherwise check if your script is run by an user
with German settings.
SaveAs "tab delimited text", load the file (ReadAll), replace tab
with ;, save
Use Range.Value to get the data into an array and dump this to
test.csv
Post by natalie
set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open("test.xls")
oExcel.DisplayAlerts = false
oExcel.ActiveWorkbook.Worksheets(1).SaveAs "test.csv", 6
oExcel.ActiveWorkbook.Close()
oExcel.Quit()
Thank you for your help!
Natalie
G***@gmail.com
2006-06-26 12:25:38 UTC
Permalink
When you record the macro, it saves with semicolons, when you run saved
macro it saves it with commas :(
Can anybody help with it please ?
Post by ekkehard.horner
Post by natalie
Hi,
can somebody help me please?
I need a solution for my script to save a excel-file to csv with
semicolon as delimiter. Since we have got Office2003 my VBScript does
not work and saves the csv-File with comma als delimiter. In Germany
the settings in the control panel are for semicolon. If I save by
myself (Data/save as/test.csv) - it's OK with semicolon.
Record the "save by myself" process as a macro and check the value
of the FileFormat parameter. If it is different from 6, try the value
in your script, otherwise check if your script is run by an user
with German settings.
SaveAs "tab delimited text", load the file (ReadAll), replace tab
with ;, save
Use Range.Value to get the data into an array and dump this to
test.csv
Post by natalie
set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open("test.xls")
oExcel.DisplayAlerts = false
oExcel.ActiveWorkbook.Worksheets(1).SaveAs "test.csv", 6
oExcel.ActiveWorkbook.Close()
oExcel.Quit()
Thank you for your help!
Natalie
Loading...