Re : ate du fichier le plus récent contenu dans le répertoire
Re bonjour a tous
Je pense avoir identifié le problème avec mes dates. Le programme tri les dates par jours puis mois puis année, de ce fait le 15/01/07 est pour lui plus grand que le 07/04/10 !!
il faudrai donc qu'il commence le tri par les années, puis les mois et enfin les jours, mais qu'il affiche ensuite dans le format français,
et là je ne sais pas comment faire,
Pouvez vous maider ??
Ci dessous macro utilisée
Sub RechDate()
Dim i, n As Long, Chemin, reponse As String, FS As FileSearch, FSO, fold, fich
Set FSO = CreateObject("Scripting.FileSystemObject")
reponse = InputBox("Commencer à partir de la ligne ??")
n = Range("A65536").End(xlUp).Row
If reponse < 8 Then reponse = 8
ActiveWorkbook.Save
For i = reponse To n
'i = ActiveCell.Row
If Range("A" & i).Value = "" Then
Else
Chemin = "\\frhofps0\frho_shared\Srv Developpement\Fiches techniques PF\" & Range("A" & i).Hyperlinks(1).Address
Set fold = FSO.getfolder(Chemin)
Chemin = fold.Path
Set FS = Application.FileSearch
With FS
.NewSearch
.LookIn = Chemin
.Filename = Range("A" & i).Value & "*"
.SearchSubFolders = False
If .Execute(msoSortByLastModified, msoSortOrderDescending) > 0 Then
Set fich = FSO.getfile(.FoundFiles(.FoundFiles.Count))
Range("I" & i).Value = CDate(fich.datelastmodified)
Else
Range("I" & i).Value = ""
End If
End With
End If
Range("A3").Value = n - i
Next i
Set fich = Nothing
Set fold = Nothing
Set FSO = Nothing
End Sub