Directory exist???

Alain - 15 mars 2001 à 10:40
 oliver - 4 avril 2001 à 17:31
Comment savoir si une directory existe déja (autrement qu'avec un ObjectScriptingFile!) et comment copier un fichier vers une directory.

Merci

Alain.

2 réponses

Private Function RepertoireExiste(MonRep As String) As Boolean

Dim myName As String
If (myName Dir(MonRep, vbDirectory)) vbEmpty Then 'On teste l 'existence du répertoire...
RepertoireExiste = True

Else

MsgBox ("le répertoire" & Chr(13) _
& Chr(34) & MonRep & Chr(34) & Chr(13) & "n'existe pas !"), _
vbExclamation
End If
End Function
0
salut,
je sais que tu as deja eu une reponse, mais :

pour tester si la directory c:\toto existe (par la gestion des erreurs) et si oui y copier le fichier file.txt qui se trouve sur c:\

sub verif()

1
on error goto 10
chdir "c:\toto"

goto 11

10
pasbon=msgbox("Le répertoire n'existe pas",vbcritical,"interruption")
goto 20

11
on error goto 0
filecopy "C:\file.txt","C:\toto\file.txt"

20
end

end sub

tu me mail si ok ?

a+
0
Rejoignez-nous