Directory Exists

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

Is there a way to tell if a directory exists. Not a file in a directory
...... but a directory.


Thank you,

Streven
 
You can use the Dir() function, passing the optional argument as vbDirectory

If Len(Dir("C:\Folder", vbDirectory)) = 0 Then
MsgBox "Folder Doesn't Exist"
End If

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
Actually that doesn't quite cut it.

If there was a file named "Folder", our example would not give the right
answer, Jack.
 
Sorry, you're right. You would have to add the trailing "\" to make Dir
return "."

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
Back
Top