file or folder exists
-2
Checks to see if a file or folder exists
The fFile variable determines whether you're
looking for a File (True) or Folder(False)
The strName variable holds the fully qualified
path you're looking For
Function CheckFileFolderExists(strName, fFile)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
CheckFileFolderExists = False
If fFile = True Then ' It's a file
If fso.FileExists(strName) = True Then
CheckFileFolderExists = True
Exit Function
End If
Else ' It's a folder/directory
If fso.FolderExists(strName) = True Then
CheckFileFolderExists = True
Exit Function
End If
End If
Set fso = Nothing
End Function






There are currently no comments for this snippet.