- Dim Str As String, StrFile As String
- Dim Pos As Integer, Posi As Integer
-
- 'Initialise le début de la recherche
- Posi = 1
-
- Str = InputBox("Entrer le chemin du fichier", "Ce fichier existe-t-il?")
-
- 'Recherche de la position du dernier "\"
- While Posi <> 0
- Pos = Posi
- Posi = InStr(Pos + 1, Str, "\", 0)
- Wend
-
- 'Affichage du nom de fichier sans le chemin
- StrFile = Right(Str, (Len(Str) - Pos))
-
- 'Détermination de l'existance du fichier
- If Dir(Str) <> vbNullString Then
- MsgBox "Le fichier " & StrFile & " existe", vbInformation, "Existant"
- Else
- MsgBox "Le fichier " & StrFile & " n'existe pas", vbInformation, "Inexistant"
- End If
Dim Str As String, StrFile As String
Dim Pos As Integer, Posi As Integer
'Initialise le début de la recherche
Posi = 1
Str = InputBox("Entrer le chemin du fichier", "Ce fichier existe-t-il?")
'Recherche de la position du dernier "\"
While Posi <> 0
Pos = Posi
Posi = InStr(Pos + 1, Str, "\", 0)
Wend
'Affichage du nom de fichier sans le chemin
StrFile = Right(Str, (Len(Str) - Pos))
'Détermination de l'existance du fichier
If Dir(Str) <> vbNullString Then
MsgBox "Le fichier " & StrFile & " existe", vbInformation, "Existant"
Else
MsgBox "Le fichier " & StrFile & " n'existe pas", vbInformation, "Inexistant"
End If