I still love books. Nothing a computer can do can compare to a book. You can't really put a book on the Internet. Three companies have offered to put books by me on the Net, and I said, 'If you can make something that has a nice jacket, nice paper with that nice smell, then we'll talk.' All the computer can give you is a manuscript. People don't want to read manuscripts. They want to read books. Books smell good. They look good. You can press it to your bosom. You can carry it in your pocket.
Ray Bradbury

Top Ten Tags

Who's Online

VBA UDF (User Defined Function) to determine if a file or folder exists, e.g.

If IsFile(""C:\test.txt"") Then
     Msgbox "File exists"
Else
     Msgbox "File does NOT exist."
End If

VBA Code

Function IsFile(FullFilePath As String) As Boolean
    
    On Error Resume Next
    
    'Return true if file exists
    IsFile = (Dir(FullFilePath) > "")

End Function

Function IsFolder(FolderPath As String) As Boolean

    On Error Resume Next

    If Right(FolderPath, 1) <> "\" Then
        FolderPath = FolderPath & "\"
    End If
    
    'Return true if folder exists
    IsFolder = (Dir(FolderPath, vbDirectory) <> vbNullString)

End Function