by Baldho (7 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 4th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Simple function that looks either for a file or a folder and returns True if it exists or False if it doesn't.
On Error Resume Next
If File = True Then x = Dir(File_Folder)
If File = False Then x = Dir(File_Folder, vbDirectory)
On Error GoTo 0
If x <> "" Then Exist = True Else Exist = False
End Function
'File_Folder is the entire path of the file or the folder you want to look for and File is either true or false. False means that the File_Folder parameter is a folder. True means it is a file.
'Here is an example of the code:
If Not Exist("C:\Security", False) then
MkDir "C:\Security"
End If
No comments have been posted about Simple function that looks either for a file or a folder and returns True if it exists or False if . Why not be the first to post a comment about Simple function that looks either for a file or a folder and returns True if it exists or False if .