leider nix genützt - immer noch willkürlich durcheinander... Hier mein Code:
Funktion:
Function SortFiles(files)
ReDim sorted(files.count - 1)
Dim file, i, j
i = 0
For Each file In files
Set sorted(i) = file
i = i + 1
Next
For i = 0 To files.count - 2
For j = i + 1 To files.count - 1
If sorted(i).DateLastModified < sorted(j).DateLastModified Then
Dim tmp
Set tmp = sorted(i)
Set sorted(i) = sorted(j)
Set sorted(j) = tmp
End If
Next
Next
SortFiles = sorted
End Function
Prozedur:
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim files
Set files = fso.GetFolder(Ordnernamepdf).files
Dim file
For Each file In SortFiles(files)
If LCase(CStr(file.path)) Like "*.pdf" Then
ShellExecuteA 0&, "Print", file.path, vbNullString, vbNullString, 0
End If
Next file
Set file = Nothing
Set files = Nothing
Set fso = Nothing
Wo soll denn da noch ein Fehler sein? Die einzigen anderen Zeilen sind die nach dem For Each...