S Steven Jun 1, 2009 #1 Is there a way to tell if a directory exists. Not a file in a directory ...... but a directory. Thank you, Streven
Is there a way to tell if a directory exists. Not a file in a directory ...... but a directory. Thank you, Streven
A Allen Browne Jun 1, 2009 #2 Function FolderExists(strPath As String) As Boolean On Error Resume Next FolderExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory) End Function Explanation: http://allenbrowne.com/func-11.html
Function FolderExists(strPath As String) As Boolean On Error Resume Next FolderExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory) End Function Explanation: http://allenbrowne.com/func-11.html
J Jack Leach Jun 1, 2009 #3 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)
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)
A Allen Browne Jun 1, 2009 #4 Actually that doesn't quite cut it. If there was a file named "Folder", our example would not give the right answer, Jack.
Actually that doesn't quite cut it. If there was a file named "Folder", our example would not give the right answer, Jack.
J Jack Leach Jun 1, 2009 #5 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)
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)