Problème avec Filessearch et .Foundfiles avec excel 2007
Bonjour , j'ai un problème avec la conversion de 2 méthodes en excel 2007. Voici mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = PATH
.SearchSubFolders = False
.Filename = ".CSV"
If .Execute > 0 Then
Sheets(1).Activate
For i = 1 To .FoundFiles.Count
Worksheets(1).Cells(i + 1, 1).Activate
ActiveCell.Value = .FoundFiles(i)
filespec = .FoundFiles(i)
FILEMANE = Trim(filespec)
FILEMANE = Mid(FILEMANE, Len(PATH) + 1)
FILEMANE = Left(FILEMANE, Len(FILEMANE) - 4)
Worksheets(1).Cells(i + 1, 3).Activate
ActiveCell.Value = FILEMANE
Set fp = CreateObject("Scripting.FileSystemObject")
Set F = fp.GetFile(filespec)
Worksheets(1).Cells(i + 1, 2).Activate
ActiveCell.Value = F.DateLastModified
FILE_ANZAHL = .FoundFiles.Count
Sheets(1).Activate
Next i
Else
MsgBox "There were no files found."
Exit Sub
End If
End With |
et voici ou j'en suis rendu dans la conversion:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Dim Chemin As String, Fichier As String
Fichier = Dir(path & "test.csv")
If Fichier <> "" Then
Sheets(1).Activate
For i = 1 To .FoundFiles.Count
Worksheets(1).Cells(i + 1, 1).Activate
ActiveCell.Value = .FoundFiles(i)
filespec = .FoundFiles(i)
FILEMANE = Trim(filespec)
FILEMANE = Mid(FILEMANE, Len(QUELLPFAD) + 1)
FILEMANE = Left(FILEMANE, Len(FILEMANE) - 4)
Worksheets(1).Cells(i + 1, 3).Activate
ActiveCell.Value = FILEMANE
Set fp = CreateObject("Scripting.FileSystemObject")
Set F = fp.GetFile(filespec)
Worksheets(1).Cells(i + 1, 2).Activate
ActiveCell.Value = F.DateLastModified
FILE_ANZAHL = .FoundFiles.Count
Sheets(1).Activate
Next i
Else
MsgBox "There were no files found."
Exit Sub
End If
End With |
Je n'ai pas trouvé comment remplacer mon foundfiles... Et si je suis dans la bonne direction...
Quelqu'un pourrait me donner un coup de main?
Merci
Julie