Check file existance : File « File Path « VBA / Excel / Access / Word






Check file existance

 
Sub ReadPersistedRecordset()
    Dim strFileName As String

    strFileName = "c:\test.txt"

    If Len(Dir(strFileName)) = 0 Then
        msgBox "File Not Found"
        Exit Sub
    End If


End Sub

 








Related examples in the same category

1.Does the specified file exist?
2.Gets the file name from the path.
3.List all files under application path
4.Select a folder
5.Select a location containing the files you want to list
6.processes multiple stored files
7.Common File Operations Simplified
8.Use array to store a list of files