Quotes in a csv file

D

Dave L

I have an Excel file that i run a marco against and it will save it as a csv
type file (with a different extension). The problem is that some of my cells
have commas in them. When i open the saved file in Notepad, Excel has put
double quotes around any cell values that have commas in them. Other than the
quotes the notepad file looks perfect. Is there a way to get those out of
there? Her is the part of my code that saves the file if that helps any.

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\dlefler\Desktop\" & PoId & ".otto",
FileFormat:=xlTextMSDOS, _
CreateBackup:=False
 
J

joel

You have a problem. A CSV file either cannot have commas in the data o
you need to add character to indicate what are real commas and which ar
the commas you need to seperate the columns. the two normal choices ar
to put twosets of commas in the CSV file when you have commas in th
cell (not the ones seperating the columns" or to put double quorte
around the data like excel has done with your file
 
J

John Keith

You have a problem. A CSV file either cannot have commas in the data or
you need to add character to indicate what are real commas and which are
the commas you need to seperate the columns. the two normal choices are
to put twosets of commas in the CSV file when you have commas in the
cell (not the ones seperating the columns" or to put double quortes
around the data like excel has done with your file.

Joel and Dave thank you for your posts. I had the same exact problem a
few weeks ago and my web searching turned up no insight about what was
causing my data to be quoted. Now I understand, thank you!

DUH, csv = COMMA separated values


John Keith
(e-mail address removed)
 
J

joel

I have often written macros for people that saves data without quotes or
read data with quotes where excel VBA idd handle the data properly. I
open the CSV file as a text file and then read/write the data one line
at a time. but this case it is impossible since there are commas in the
data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top