Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what if file doesnt exist?

Status
Not open for further replies.

mettodog

Vendor
Jul 11, 2000
94
US
in form load

open "C:\me.text"

how can i make it so that if the file doesnt exist it will make a new one with that name?
 
It depends what mode you are opening the file as. If you use

Open "C:\me.txt" For Append As #1

This will automatically create the file if it does not exist.

How are you opening the file??

Simon
 
If you are going to rewrite the file every time then the Output mode will allow you to replace the existing file. The Append mode will add to the end of the file, if it exists, or start a new file if it doesn't.

Open "C:\me.txt" For Output as #1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top