by Ian Ippolito (vWorker) (14 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
Determines if a file exists
Improved version--detects hidden files too!
Inputs
filename--file to validate
Code Returns
'returns true or false
Function Validate_File (ByVal FileName As String) As Integer
Dim fileFile As Integer
'attempt to open file
fileFile = FreeFile
On Error Resume Next
Open FileName For Input As fileFile
'check for error
If Err Then
Validate_File = False
Else
'file exists
'close file
Close fileFile
Validate_File = True
End If
End Function