Originally posted by nishantp
Sorry, sorry, I did test it...just not enough. The above code it wrong, it works but only on root directories...not sub dirs. This code does the trick (has been tested properly) :
VB Code:
  1. Function DirExist(ByVal Path As String) As Boolean
  2. If Right(Path, 1) <> "\" Then Path = Path & "\"
  3. DirExist = Dir(Path, vbDirectory) <> ""
  4. End Function
Thanks for the pointers Tygur
I'm guessing you didn't test its reaction to files

It will return true if you give it a file. Since it's supposed to check for the existence of a directory, not a file, it should return false.

EDIT: I just tested it myself, and I found that it gives an error if you give it a filename, instead of just returning true. The function posted by [Digital-X-Treme] does the same thing.