ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving a txt file (https://www.excelbanter.com/excel-programming/378007-saving-txt-file.html)

diacci1st

Saving a txt file
 
HI
On the below code I would like to add a variable that uses the value of a
text box from a form:
So the form is AABB the text box is NAME

I have tried to change the code below to
Set a = fs.CreateTextFile("c:\GL1025\& ABB.NAME &".txt", True) but it does
not work
coul you please help?

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\GL1025\testfile.txt", True)
For Each Cell In Range("A1:A65000")
s = Cell.Value
a.WriteLine (s)
Next
a.Close


End Sub



Martin Fishlock[_4_]

Saving a txt file
 
There appears to be a typo :
Set a = fs.CreateTextFile("c:\GL1025\& ABB.NAME &".txt", True)
Set a = fs.CreateTextFile("c:\GL1025\" & ABB.NAME & ".txt", True)


try specifing the text propery:
Set a = fs.CreateTextFile("c:\GL1025\& ABB.NAME.TEXT &".txt", True)



--
HTHs Martin


"diacci1st" wrote:

HI
On the below code I would like to add a variable that uses the value of a
text box from a form:
So the form is AABB the text box is NAME

I have tried to change the code below to
Set a = fs.CreateTextFile("c:\GL1025\& ABB.NAME &".txt", True) but it does
not work
coul you please help?

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\GL1025\testfile.txt", True)
For Each Cell In Range("A1:A65000")
s = Cell.Value
a.WriteLine (s)
Next
a.Close


End Sub



Martin Fishlock[_4_]

Saving a txt file
 
I do not believe that there is.

You probably have to either manually insert them or delete the hidden ones.
--
HTHs Martin


"diacci1st" wrote:

HI
On the below code I would like to add a variable that uses the value of a
text box from a form:
So the form is AABB the text box is NAME

I have tried to change the code below to
Set a = fs.CreateTextFile("c:\GL1025\& ABB.NAME &".txt", True) but it does
not work
coul you please help?

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\GL1025\testfile.txt", True)
For Each Cell In Range("A1:A65000")
s = Cell.Value
a.WriteLine (s)
Next
a.Close


End Sub



Fingerjob

Saving a txt file
 
Hi ..

Some issus.

One place you write AABB and in the code you write ABB

("c:\GL1025\& ABB.NAME &".txt",

you should add one "

("c:\GL1025\" & ABB.NAME &".txt",



diacci1st skrev:

HI
On the below code I would like to add a variable that uses the value of a
text box from a form:
So the form is AABB the text box is NAME

I have tried to change the code below to
Set a = fs.CreateTextFile("c:\GL1025\& ABB.NAME &".txt", True) but it does
not work
coul you please help?

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\GL1025\testfile.txt", True)
For Each Cell In Range("A1:A65000")
s = Cell.Value
a.WriteLine (s)
Next
a.Close


End Sub




All times are GMT +1. The time now is 07:45 AM.

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