lolo
-
13 janv. 2000 à 11:20
CsM Skate
Messages postés60Date d'inscriptiondimanche 8 mai 2005StatutMembreDernière intervention20 mai 2007
-
22 juin 2005 à 23:51
Quelle est la commande pour savoir si un fichier existe ou non ???
Merci d'avance
Private Function FileExist(File As String) As Boolean
Dim L As Long
On Error GoTo FExErr
L = FileLen(File)
FileExist = True
Exit Function
FExErr: FileExist = False
Exit Function
End Function
Tu n'as plus qu'à utiliser cette fonction de la façon suivante:
If FileExist("C:\Mon Fichier") then
MsgBox "Le fichier existe"
Else
MsgBox "Le fichier n'existe pas"
End If
Cependant, il est vrai que la fonction "DIR" est tout aussi efficace.