*Bonjour! j'avais posté hier sur le forum concernant une fonction qui me permet de trouver un fichier csv en utilisant seulement une petite partie de son nom..
j'ai essayé avec ca pour trouver le fichier qui se termine par 510572 mais le programme se plante et je dois le fermer sinon ca se termine pas:
Option Explicit
Sub Test()
Dim strPath As String
Dim strFile As String
strPath = "X:\Verzeichnis\Unterverzeichnis"
If Right$(strPath, 1) <> "\" _
Then strPath = strPath & "\"
strfile=dir(strpath & "*510572.csv")
Do While strFile <> ""
'hier auf Kriterien prüfen
' z.B
If InStr(strFile, "337") And GetExtension(strFile) = "pdf" Then
Debug.Print "PDF:", strFile
ElseIf InStr(strFile, "Foto") And GetExtension(strFile) = "jpg" Then
Debug.Print "FOTO:", strFile
ElseIf GetExtension(strFile) Like "csv*" Then
Debug.Print "EXCEL:", strFile
' ElseIf ... Then
' ...
End If
strfile=dir(strpath & "*510572.csv")
Loop
End Sub
Function GetExtension(File As String) As String
Dim i As Long
i = InStrRev(File, ".")
If i Then GetExtension = Right$(File, Len(File) - i)
End Function
j'apprecierai tout aide! merci beaucoup