how do I remove quotation marks from .CSV file

G

Guest

I'm using Excel VBA to load values from worksheet cells and then writing
these to a .csv file. My problem is that when the CSV is viewed in
NOtepad/wordpad, the text field value are enclosed in quotation marks ".

When I first did this they were'nt and I can't think what's changed. Also
not all text fields appear to have had quotation marks

I've tried applying different fomatting on the sheet and saving as .txt
rather than .csv but no difference

I need to send the file to a guy whose loader can't cope with quotation
marks but frankly for the moment I'm stumped.

Any ideas?

ps the file open line is :
Open file_path For Append Access Write As #1

Cheers
 
D

DM Unseen

Ratty,

use Activesheet.SaveAs("mytextfile.csv",xlCSV)

there are a lot of supported exportformats(see help for al supported
formats), no need to write this yourself!

DM Unseen
 
J

Jim Rech

Excel uses quotes where necessary for clarity in saving CSV files. For
instance, if a cell contains a comma or a quote, quotes would be necessary.
If you have a comma in a cell then without quotes any "loader" program would
get it wrong wouldn't it?

I think you have to find all the characters in your data that triggers Excel
adding quotes and eliminate them.

--
Jim
| I'm using Excel VBA to load values from worksheet cells and then writing
| these to a .csv file. My problem is that when the CSV is viewed in
| NOtepad/wordpad, the text field value are enclosed in quotation marks ".
|
| When I first did this they were'nt and I can't think what's changed. Also
| not all text fields appear to have had quotation marks
|
| I've tried applying different fomatting on the sheet and saving as .txt
| rather than .csv but no difference
|
| I need to send the file to a guy whose loader can't cope with quotation
| marks but frankly for the moment I'm stumped.
|
| Any ideas?
|
| ps the file open line is :
| Open file_path For Append Access Write As #1
|
| Cheers
 
J

John Cadagin

I'm using Excel VBA to load values from worksheet cells and then writing
these to a .csv file. My problem is that when the CSV is viewed in
NOtepad/wordpad, the text field value are enclosed in quotation marks ".

When I first did this they were'nt and I can't think what's changed. Also
not all text fields appear to have had quotation marks

I've tried applying different fomatting on the sheet and saving as .txt
rather than .csv but no difference

I need to send the file to a guy whose loader can't cope with quotation
marks but frankly for the moment I'm stumped.

Any ideas?

ps the file open line is :
Open file_path For Append Access Write As #1

Cheers

When this has happened to me before, it's been when I had numbers
formatted with commas in them. EG 128,567.32 instead of just
128567.32. Then the quotes go around the numbers so they don't split
into different cells when reopened.
 

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