ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with text file (https://www.excelbanter.com/excel-programming/443981-help-text-file.html)

Gordon Rainsford[_6_]

Help with text file
 
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?

GS[_5_]

Help with text file
 
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.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc



Gordon Rainsford[_6_]

Help with text file
 
Thanks for this good advice - it got me on the right track.

Gordon Rainsford

On Dec 6, 10:36*pm, GS wrote:
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.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

- Show quoted text -



GS[_5_]

Help with text file
 
Gordon Rainsford was thinking very hard :
Thanks for this good advice - it got me on the right track.

Gordon Rainsford

On Dec 6, 10:36*pm, GS wrote:
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.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

- Show quoted text -


Always glad to be of help!<g

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




All times are GMT +1. The time now is 11:46 PM.

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