Check if File Exists Including Hidden Files
Simple function to check if file exists. Detects Normal & Hidden files. Improvement of code from Greg G., and incorporating a suggestion by Larry Rebich.
Inputs
A Valid Pathname as String.
Returns
Boolean TRUE if file exists at path specified
Side Effects
Simply returns FALSE if an invalid path is encountered
Rate Check if File Exists Including Hidden Files
(4(4 Vote))
Public Function FileExists(strFile as String) As String
On Error Resume Next 'Doesn't raise error - FileExists will be false
'if error occurs
'a valid path would be someting like "C:\Windows\win.ini" - Full path
'must be specified
FileExists = Dir(strFile, vbHidden) <> ""
End Function
Check if File Exists Including Hidden Files Comments
No comments yet — be the first to post one!
Post a Comment