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 31 32 33 34
| Option Explicit
Dim objShell, objFolder, colItems, objItem, fso, strIn, J, MonFich, tb(100), n, Fich, I
strIn = InputBox("Chemin du dossier à explorer : ","Chemin à explorer","C:\Tmp")
If strIn = "" Then Wscript.Quit(0)
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strIn)
Set colItems = objFolder.Items
n = colItems.Count ': MsgBox n
If Right(strIn,1)<> "\" Then strIn = strIn + "\"
Dim K, L, S : S = ""
L = 0
For K = 0 to n-1
If Ucase(Right(colItems.Item(K),4))=".PDF" Then
Tb(L) = colItems.Item(K)
'Msgbox (L) & " : " & tb(L)
L = L +1
End If
Next
I = 0
For J = 0 To L - 2
IF fso.GetFile(strIn & Tb(J)).DateCreated > fso.GetFile(strIn & Tb(J+1)).DateCreated Then
MonFich = tb(J)
Else : MonFich = tb(J+1)
End If
I = I + 1
' S = S + MonFich & " ===> " & Cstr(I) + Vbcrlf
Next
' MsgBox S
' Set Fich = fso.GetFile(strIn & MonFich)
' MsgBox Fich
colItems.Item(I-1).InvokeVerbEx("Print") |
Partager