Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking for the Existence of a Directory
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00441072
Message ID:
00441157
Views:
10
>I have a program that will ask the user for a directory name. I need to be able to verify whether or not that directory exists.
>
>Can anyone give me some example code for checking for the existence of a directory contained in a string?
>
>Thanks in advance,
>
>Ben Holton

Hi Chet,

Another approach to your problem would be display BrowseForFolder window. In this case you don't have to validate what users typed.
Anyway, if you want to verify whether or not a directory exists, use code below:
Dim FSO as Object
Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
if not FSO.FolderExists(strFolder) then
	MsgBox "Folder " & strFolder & " doesn't exist."
end if
Set FSO = Nothing
Just my 2 cents, Igor
Igor Gelin
Database Developer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform