|
-
Jun 24th, 2000, 12:32 PM
#1
Thread Starter
Addicted Member
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
The MORE I get to know,
I realize that I know NOTHING !
-
Jun 24th, 2000, 12:39 PM
#2
Hyperactive Member
Append
use this
Code:
Open "c:\temp\lirlir.txt" For Append As #1
Write #1, "lirlir", "lir"
Close #1
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 24th, 2000, 12:40 PM
#3
Hyperactive Member
You can do it two ways. Using the open method, you would use the following syntax:
Code:
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
In the above example, you can use write, but only if you want the text to be written into the file with quote marks like
"lir""lir"
Or you could use the FilesystemObject
Code:
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
Hope this helps
(Using VB 6 SP 3)
-
Jun 24th, 2000, 12:47 PM
#4
Thread Starter
Addicted Member
Very helpfull tanks u both
Very helpfull tanks u both
The MORE I get to know,
I realize that I know NOTHING !
-
Jun 24th, 2000, 08:43 PM
#5
if you dont want to use filesystem object, but you dont want the quotation marks, use print,
Code:
Print #FileNumber, Variable & "or text"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|