I have a textfile, how can I append text on the TOP of the current textfile?
Printable View
I have a textfile, how can I 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.
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