Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for the Existence of a Directory
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00441072
Message ID:
00441157
Vues:
12
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform