If File Doesn't Exist, Create It

Lanc1988

Well-known member
Joined
Nov 27, 2003
Messages
508
I keep having to use On Error Resume Next to get around this problem, so could someone help me by telling me the code to have it create the file if it doesnt exist?
 
Lanc1988 said:
I keep having to use On Error Resume Next to get around this problem, so could someone help me by telling me the code to have it create the file if it doesnt exist?

If System.IO.File.Exists(path) = False then

Code to create your file
System.IO.File.Create(path)

End if

or if you want to get suave:

With System.IO.File
If .Exists(path) = False Then .Create(path)
End With

Im not sure exactly what System.IO.File.Create creates... I assume a blank text file format.
 
Back
Top