OVH Cloud OVH Cloud

Pb

2 réponses
Avatar
CEBE Patrick
avant tout merci à FxM pour soluce
comment avec le code ci dessous je peut lister autres chose que des fichier
*.XLS
merci par avance.
Sub dernier_modifie()
Application.ScreenUpdating = False
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fs = Application.FileSearch
With fs
.LookIn = "c:\temp"
.SearchSubFolders = True
.Execute
For Each f In .FoundFiles
Set File = FSO.GetFile(f)
Range("a1") = File.DateLastModified
Range("b1") = f
Range("a1").Insert Shift:=xlDown
Range("b1").Insert Shift:=xlDown
Next f
End With
Set FSO = Nothing
Set File = Nothing
Range("a1").Delete Shift:=xlUp
Range("b1").Delete Shift:=xlUp
Range(Range("a1:b1"), Range("a1").End(xlDown)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False
Range("b1").Select
plus_recent = ActiveCell
Application.DisplayAlerts = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

2 réponses

Avatar
Nicolas B.
Salut Patrick,

Rajoute ceci avant Execute :
.FileType = msoFileTypeAllFiles


A+
--
Nicolas B.

Adresse @adresse.bidon.com invalide,
E-mail : www.cerbermail.com/?gAAILfkPsC


avant tout merci à FxM pour soluce
comment avec le code ci dessous je peut lister autres chose que des
fichier
*.XLS
merci par avance.
Sub dernier_modifie()
Application.ScreenUpdating = False
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fs = Application.FileSearch
With fs
.LookIn = "c:temp"
.SearchSubFolders = True
.Execute
For Each f In .FoundFiles
Set File = FSO.GetFile(f)
Range("a1") = File.DateLastModified
Range("b1") = f
Range("a1").Insert Shift:=xlDown
Range("b1").Insert Shift:=xlDown
Next f
End With
Set FSO = Nothing
Set File = Nothing
Range("a1").Delete Shift:=xlUp
Range("b1").Delete Shift:=xlUp
Range(Range("a1:b1"), Range("a1").End(xlDown)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending,
Header:=xlGuess, _ OrderCustom:=1, MatchCase:úlse
Range("b1").Select
plus_recent = ActiveCell
Application.DisplayAlerts = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub


Avatar
michdenis
Bonsoir CEBE,.

Moi, j'ajouterais :

Sub dernier_modifie()
Application.ScreenUpdating = False
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fs = Application.FileSearch
With fs
.LookIn = "c:temp"
.SearchSubFolders = True
.FileName = "*.*"
'.../ etc


Salutations!


"CEBE Patrick" a écrit dans le message de news:403e3a2f$0$28619$
avant tout merci à FxM pour soluce
comment avec le code ci dessous je peut lister autres chose que des fichier
*.XLS
merci par avance.
Sub dernier_modifie()
Application.ScreenUpdating = False
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fs = Application.FileSearch
With fs
.LookIn = "c:temp"
.SearchSubFolders = True
.Execute
For Each f In .FoundFiles
Set File = FSO.GetFile(f)
Range("a1") = File.DateLastModified
Range("b1") = f
Range("a1").Insert Shift:=xlDown
Range("b1").Insert Shift:=xlDown
Next f
End With
Set FSO = Nothing
Set File = Nothing
Range("a1").Delete Shift:=xlUp
Range("b1").Delete Shift:=xlUp
Range(Range("a1:b1"), Range("a1").End(xlDown)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:úlse
Range("b1").Select
plus_recent = ActiveCell
Application.DisplayAlerts = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub