|
-
Oct 10th, 2000, 01:36 AM
#1
Thread Starter
Frenzied Member
Well...
A easy one.
I want to write to
an existing file, with
out deleting the old
contents. I just want to
add a string like "Test"
on the next line.
-
Oct 10th, 2000, 02:12 AM
#2
Frenzied Member
this example should help:
Code:
Option Explicit
Private Sub Command1_Click()
Static i As Integer
Dim filename As String
Dim fnum As Byte
filename = "c:\ttt.txt"
fnum = FreeFile
Open filename For Append As fnum
Print #fnum, "extra line " & i
Close fnum
i = i + 1
End Sub
-
Oct 10th, 2000, 02:38 AM
#3
Addicted Member
You could also use the Microsoft Scripting Runtime Library.
Then your code would be like this
Dim fsObject as new FileSystemObject
dim fsTextStream as TextStream
Set fsTextStream = fsObject.OpenTextFile("TestkFileName")
fsTextStream.AtEndOfStream
fsTextStream.WriteLine 'Place your line here
fsTextStream.Close
Set fsObject = Nothing
Set fsTextStream = Nothing
Catch you later,
Jeroen Hoekemeijer
Code:
If 1 = 2 Then MajorError
-
Oct 10th, 2000, 02:50 AM
#4
Frenzied Member
Yeah don't bother with my suggestion! it actually works.
try jeroenh's which doesn't
I could probably post a few hundred lines of code using APIs which does the same thing as well.
After all, the more code the better eh?!!!!
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
|