Help with text file

  • Thread starter Thread starter Gordon Rainsford
  • Start date Start date
G

Gordon Rainsford

I've written some VBA that populates data in a spreadsheet, then
combines the data so that there's only data in the first column and
each row in the first column is one string of data.

I need to save it as a textfile, but I'm having two problems with
this.

I can't seem to save it without a .txt extension being added to the
filename..

Secondly, one of the cells contains the text 'M,2' (no quotation
marks)
Unfortunately when the file is saved as a textfile, this is converted
to '"M,2"'

How can I save it exactly as I want it?
 
Gordon Rainsford presented the following explanation :
I've written some VBA that populates data in a spreadsheet, then
combines the data so that there's only data in the first column and
each row in the first column is one string of data.

I need to save it as a textfile, but I'm having two problems with
this.

I can't seem to save it without a .txt extension being added to the
filename..

Secondly, one of the cells contains the text 'M,2' (no quotation
marks)
Unfortunately when the file is saved as a textfile, this is converted
to '"M,2"'

How can I save it exactly as I want it?

If you use VBA to dump the data into a text file via VBA's standard
file I/O functions, you can save it with any filename.ext you like.
Also, the data will be exactly however you combine it. This would be
easy to do by loading it into an array or delimited strings followed by
a vbCrLf for each row of data.

Look up file I/O and the use of the Join() and Split() functions.
 
Thanks for this good advice - it got me on the right track.

Gordon Rainsford
 
Back
Top