ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   .CSV file format - comma or semi-colon (https://www.excelbanter.com/excel-worksheet-functions/6082-csv-file-format-comma-semi-colon.html)

antifashionpimp

.CSV file format - comma or semi-colon
 
Hello,

I have an existing file that is in .csv file format. The comma ( , ) is used
to seperate the values. When I open the file in Excel, it works fine and
displays the values seperately in cells.

Now I am creating my own .csv files through VBA, with the SaveAs method for
Worksheet objects.
E.g. I use the following syntax:

objWS.SaveAs Filename:="c:\temp\" + gstrNameVP + ".csv",
FileFormat:=xlCSVWindows

The file saves as .csv BUT the values are seperated by a semi-colon( ; )
which is not what I want. I want comma-seperated. Otherwise when I open the
..csv in Excel, the values do not display correctly in the cells.
I cannot understand how the original file was saved using commas for
seperating the values.
When I create a file in Excel, and save it as .csv, it always uses
semi-colon seperators.


Can somebody please tell me how I can seperate the values by commas in the
..csv properly?
Thanks in advance and for paying attention to my post.

Jean


Bernie Deitrick

Jean,

Try changing your list separator value, which is set by your operating
system.

Use this (though the specific names and tabs, etc. may change with Windows
version - these are for Win XP Prof.)
Start | Settings | Control panel | Regional and Language Options | Regional
Options | Customize.... | Number tab | List Separator - make sure it is a
comma.

HTH,
Bernie
MS Excel MVP

"antifashionpimp" wrote in
message ...
Hello,

I have an existing file that is in .csv file format. The comma ( , ) is

used
to seperate the values. When I open the file in Excel, it works fine and
displays the values seperately in cells.

Now I am creating my own .csv files through VBA, with the SaveAs method

for
Worksheet objects.
E.g. I use the following syntax:

objWS.SaveAs Filename:="c:\temp\" + gstrNameVP + ".csv",
FileFormat:=xlCSVWindows

The file saves as .csv BUT the values are seperated by a semi-colon( ; )
which is not what I want. I want comma-seperated. Otherwise when I open

the
.csv in Excel, the values do not display correctly in the cells.
I cannot understand how the original file was saved using commas for
seperating the values.
When I create a file in Excel, and save it as .csv, it always uses
semi-colon seperators.


Can somebody please tell me how I can seperate the values by commas in the
.csv properly?
Thanks in advance and for paying attention to my post.

Jean





All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com