when i'm writing the next code it overwrite the last file.
i want to add a new data at the EOF .
Open "c:\temp\lirlir.txt" For Output As #1
Write #1, "lirlir", "lir"
Close #1
Printable View
when i'm writing the next code it overwrite the last file.
i want to add a new data at the EOF .
Open "c:\temp\lirlir.txt" For Output As #1
Write #1, "lirlir", "lir"
Close #1
use this
Code:Open "c:\temp\lirlir.txt" For Append As #1
Write #1, "lirlir", "lir"
Close #1
You can do it two ways. Using the open method, you would use the following syntax:
In the above example, you can use write, but only if you want the text to be written into the file with quote marks likeCode:Open "c:\temp\lirlir.txt" For Append As #1
Do while not EOF(1)
Print #1,Text & vbcrlf 'Add the vbcrlf if you want a hard space after each line of text.
Loop
Close #1
"lir""lir"
Or you could use the FilesystemObject
Hope this helpsCode:Dim fso, sTemp(1)
Set fso=CreateObject("scripting.FileSystemObject")
Set sTemp(0)=fso.getFile("c:\temp\lirlir.txt")
Set sTemp(1)=sTemp(0).OpenAsTextStream(8,-2)
sTemp(1).Write Text
sTemp(1).Close
(Using VB 6 SP 3)
Very helpfull tanks u both
if you dont want to use filesystem object, but you dont want the quotation marks, use print,
Code:Print #FileNumber, Variable & "or text"