Remove double quotes from text file

D

Dave L

I have a macro that saves a csv file with only one cell with a value. The
cell contains commas though so it saves it in the text file with quote around
it. Ex:

Cell contents:
,value,value,value,,,

When the text file is open in notepad:
",value,value,value,,,"

Is there any way to get rid of the quotes and have it read exactly like it
does when open in Excel?
 
T

Tom Hutchins

Have your macro save it as a .prn file instead of .csv. In the Save As dialog
this is called Formatted text (space delimited)(*.prn). The code may look
like this:

ActiveWorkbook.SaveAs Filename:= _
"D:\Data\Book1.prn", FileFormat:= _
xlTextPrinter, CreateBackup:=False

Then, if desired, you can change the extension on the file after you close it.

Hope this helps,

Hutch
 

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