erasing content of text file.

Fuga

Registered User.
Local time
Today, 04:00
Joined
Feb 28, 2002
Messages
566
Hi.

I would like to open a text file and erase its content automatically. This is so it won´t be too large.

I´ve seen one mehtod which involves looping through all the lines and replacing them, but isn´t there a "delete everything" method?

After deleting, I want to save the file.

Fuga.
 
Why don't you just delete the file itself?

Or just replace it with a new file with the same name like this.

Code:
Private Sub ReplaceOldFile()
    Open "c:\text1.txt" For Output As #1
    Close #1
End Sub
 
Thanks Tim!

Yes, replacing the file with a new one will do just fine, I think. I´ll have a try with your code.

Fuga.
 

Users who are viewing this thread

Back
Top Bottom