Simple function that looks either for a file or a folder and returns True if it exists or False if
Simple function that looks either for a file or a folder and returns True if it exists or False if it doesn't.
Rate Simple function that looks either for a file or a folder and returns True if it exists or False if
(1(1 Vote))
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
Simple function that looks either for a file or a folder and returns True if it exists or False if Comments
No comments yet — be the first to post one!
Post a Comment