- Public Function trouve_le_nom_long(file As String) As String
-
- Dir1.Path = "\"
- chemin = "\"
- position = 4
- Do
- a = InStr(position + 1, file, "\")
- If a = 0 Then GoTo fin
-
- dossier = Mid(file, position, a - position)
-
-
- If InStr(1, dossier, "~") <> 0 Then
-
- If chemin <> "\" Then
-
- If Right(Dir1.Path, 1) = "\" Then
- nom = Dir1.Path
- Else: nom = Dir1.Path & "\"
-
- End If
-
- position = Len(nom) + 1
-
- End If
-
-
-
-
- For i = 0 To Dir1.ListCount - 1
- If Left(dossier, InStr(1, dossier, "~") - 1) = UCase(Mid(Dir1.List(i), position, Len(Left(dossier, InStr(1, dossier, "~") - 1)))) And Len(Mid(Dir1.List(i), position)) > 8 Then
-
-
- incr = Len(Dir1.List(i)) + 1
- Do
- incr = incr - 1
- Loop Until Mid(Dir1.List(i), incr, 1) = "\"
-
- zaza = Right(Dir1.List(i), Len(Dir1.List(i)) - incr)
-
-
-
- Liste.AddItem (zaza)
- End If
-
- Next
-
- chemin = chemin & Liste.List(Right(dossier, 1) - 1) & "\"
- Liste.Clear
-
-
- Else
-
-
- For i = 0 To Dir1.ListCount - 1
- If UCase(Right(Dir1.List(i), Len(dossier))) = dossier Then dossier = Right(Dir1.List(i), Len(dossier))
- Next
-
- chemin = chemin & dossier & "\"
-
- End If
-
- Dir1.Path = chemin
-
- position = a + 1
-
-
-
- Loop
-
-
- fin:
- trouve_le_nom_long = Dir1.Path
- namen = trouve_le_nom_du_fichier(file, Dir1.Path)
- If Right(trouve_le_nom_long, 1) = "\" Then
- trouve_le_nom_long = trouve_le_nom_long & namen
- Else: trouve_le_nom_long = trouve_le_nom_long & "\" & namen
- End If
-
-
-
-
- End Function
-
-
-
-
-
-
- Public Function trouve_le_nom_du_fichier(abc As String, chemin_initial As String) As String
-
- Liste.Clear
-
-
- File1.Path = chemin_initial
-
- incr = Len(abc) + 1
- Do
- incr = incr - 1
- Loop Until Mid(abc, incr, 1) = "\"
-
- nom = Mid(abc, incr + 1)
-
-
- a = InStr(1, nom, "~")
- If a = 0 Then
-
- For i = 0 To File1.ListCount - 1
- If UCase(File1.List(i)) = nom Then
- trouve_le_nom_du_fichier = File1.List(i)
- End If
- Next
-
- GoTo fin
-
- Else
-
-
-
- For i = 0 To File1.ListCount - 1
- If Left(nom, 6) = UCase(Mid(File1.List(i), 1, Len(Left(nom, 6)))) Then
-
- Liste.AddItem (File1.List(i))
- End If
-
- Next
-
- trouve_le_nom_du_fichier = Liste.List(Val(Mid(nom, InStr(1, nom, "~") + 1)) - 1)
-
-
-
- End If
-
-
- fin:
-
- End Function
-
Public Function trouve_le_nom_long(file As String) As String
Dir1.Path = "\"
chemin = "\"
position = 4
Do
a = InStr(position + 1, file, "\")
If a = 0 Then GoTo fin
dossier = Mid(file, position, a - position)
If InStr(1, dossier, "~") <> 0 Then
If chemin <> "\" Then
If Right(Dir1.Path, 1) = "\" Then
nom = Dir1.Path
Else: nom = Dir1.Path & "\"
End If
position = Len(nom) + 1
End If
For i = 0 To Dir1.ListCount - 1
If Left(dossier, InStr(1, dossier, "~") - 1) = UCase(Mid(Dir1.List(i), position, Len(Left(dossier, InStr(1, dossier, "~") - 1)))) And Len(Mid(Dir1.List(i), position)) > 8 Then
incr = Len(Dir1.List(i)) + 1
Do
incr = incr - 1
Loop Until Mid(Dir1.List(i), incr, 1) = "\"
zaza = Right(Dir1.List(i), Len(Dir1.List(i)) - incr)
Liste.AddItem (zaza)
End If
Next
chemin = chemin & Liste.List(Right(dossier, 1) - 1) & "\"
Liste.Clear
Else
For i = 0 To Dir1.ListCount - 1
If UCase(Right(Dir1.List(i), Len(dossier))) = dossier Then dossier = Right(Dir1.List(i), Len(dossier))
Next
chemin = chemin & dossier & "\"
End If
Dir1.Path = chemin
position = a + 1
Loop
fin:
trouve_le_nom_long = Dir1.Path
namen = trouve_le_nom_du_fichier(file, Dir1.Path)
If Right(trouve_le_nom_long, 1) = "\" Then
trouve_le_nom_long = trouve_le_nom_long & namen
Else: trouve_le_nom_long = trouve_le_nom_long & "\" & namen
End If
End Function
Public Function trouve_le_nom_du_fichier(abc As String, chemin_initial As String) As String
Liste.Clear
File1.Path = chemin_initial
incr = Len(abc) + 1
Do
incr = incr - 1
Loop Until Mid(abc, incr, 1) = "\"
nom = Mid(abc, incr + 1)
a = InStr(1, nom, "~")
If a = 0 Then
For i = 0 To File1.ListCount - 1
If UCase(File1.List(i)) = nom Then
trouve_le_nom_du_fichier = File1.List(i)
End If
Next
GoTo fin
Else
For i = 0 To File1.ListCount - 1
If Left(nom, 6) = UCase(Mid(File1.List(i), 1, Len(Left(nom, 6)))) Then
Liste.AddItem (File1.List(i))
End If
Next
trouve_le_nom_du_fichier = Liste.List(Val(Mid(nom, InStr(1, nom, "~") + 1)) - 1)
End If
fin:
End Function