Hi all,

I have searched but can't find an answer to this.

If I have a string containing a file path. eg "R:\Administration\Timekeeping\test.xls" How do I check that the path exists?

If the computer running the app is not connected to the network, and hence the path doesn't exist, then using this code

Code:
Public Function FileExists(strFilePath As String) As Boolean
    FileExists = False 'Assume the worst!
    'Make sure a filename was passed!
    If Len(strFilePath) > 0 Then
              'Check to see if the file exists!
              If Len(Dir$(strFilePath)) > 0 Then
                  'The file exists!
                  FileExists = True
              End If
    End If
End Function
If Len(Dir$(strFilePath)) > 0 Then

still creates an error "bad file name or number"

Can someone suggest a way of finding out whether or not a path exists?