Dire si un fichier existe

Vbsupernul Messages postés 287 Date d'inscription vendredi 25 octobre 2002 Statut Membre Dernière intervention 18 janvier 2004 - 5 nov. 2002 à 13:07
cs_MyC Messages postés 94 Date d'inscription lundi 23 septembre 2002 Statut Membre Dernière intervention 22 avril 2003 - 6 nov. 2002 à 09:53
Comment dit on "si un fichier existe"?
Merci de me répondre.

4 réponses

BasicInstinct Messages postés 1470 Date d'inscription mardi 5 février 2002 Statut Membre Dernière intervention 20 octobre 2014 12
5 nov. 2002 à 14:03
Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long

s'utilise :
dim Fexiste as boolean

Fexiste=PathFileExists("C:\Program files\Desk3\readme.txt")

Fexiste=True si le fichier existe
0
freud2000 Messages postés 37 Date d'inscription lundi 1 juillet 2002 Statut Membre Dernière intervention 5 mai 2004
5 nov. 2002 à 14:22
Tu peux aussi faire comme ca.

Set fs = CreateObject("Scripting.FileSystemObject")
fs.FileExists("c:\boot.ini")

0
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
5 nov. 2002 à 15:48
J'ai fait une source nommée OBJET : Gestion fichiers qui parle de ca, va la voir si tu veux un exemple concret.

DARK SIDIOUS
0
cs_MyC Messages postés 94 Date d'inscription lundi 23 septembre 2002 Statut Membre Dernière intervention 22 avril 2003
6 nov. 2002 à 09:53
Il y a beaucoup plus simple :

private function FichierExist(cheminFichier as string)as boolean

FichierExist = iif(Dir(cheminFichier)<>"",True,False)

end function
0
Rejoignez-nous