|
-
May 26th, 2005, 08:18 AM
#1
Thread Starter
Fanatic Member
Append text on the top of the current textfile? [RESOLVED]
I have a textfile, how can I append text on the TOP of the current textfile?
Last edited by Pirre001; May 26th, 2005 at 10:03 AM.
Reason: Resolved
-
May 26th, 2005, 08:38 AM
#2
Re: Append text on the top of the current textfile?
this is one way.
VB Code:
Dim str1 As String
Open "C:\yourfile.txt" For Binary As #1
str1 = Space$(LOF(1))
Get #1, 1, str1
Put #1, 1, Text1.Text & vbCrLf & str1
Close #1
casey.
-
May 26th, 2005, 08:40 AM
#3
Re: Append text on the top of the current textfile?
Try something like this:
VB Code:
Dim intFile As Integer
Dim strFile As String
intFile = FreeFile
Open "yourfile.txt" For Input as #intFile
strFile = Iinput(FileLen("yourfile.txt"), intFile)
Close #intFile
strFile = "Some text here..." & vbNewLine & strFile
Open "yourfile.txt" For Binary Access Write As #intFree
Put #intFree, , strFile
Close #intFree
Cheers,
RyanJ
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
|