as I let to append a line to the beginning of a file in which they are already there other lines ?
......:::::http://nottehorror.too.it/:::::......
This one needs one textbox & 1 command button ... VB Code: Private Sub Command1_Click() Dim strCurrentFileText As String Open "C:\File.txt" For Input As #1 Do Until EOF(1) strCurrentFileText = Input(LOF(1), 1) Loop Close #1 Open "C:\File.txt" For Output As #1 strCurrentFileText = "Hello World" & vbCrLf & strCurrentFileText Print #1, strCurrentFileText Close #1 MsgBox "File Written To!" Unload Me End Sub
Private Sub Command1_Click() Dim strCurrentFileText As String Open "C:\File.txt" For Input As #1 Do Until EOF(1) strCurrentFileText = Input(LOF(1), 1) Loop Close #1 Open "C:\File.txt" For Output As #1 strCurrentFileText = "Hello World" & vbCrLf & strCurrentFileText Print #1, strCurrentFileText Close #1 MsgBox "File Written To!" Unload Me End Sub
Please rate this post if it was useful for you! Please try to search before creating a new post, Please format code using [ code ][ /code ], and Post sample code, error details & problem details
Forum Rules