Probier mal das...
27.11.2012 19:00:12
robert
Hi,
Deinen Pfad musst Du noch eintragen bei "Hier Dein Pfad"
Gruß
robert
Public Sub Dateien()
Const STRFOLDER As String = "Hier Dein Pfad" ' Anpassen
Dim objShell As Object, objFolder As Object
Dim bytIndex As Byte, intColumn As Integer, lngRow As Long
Dim varNAME, arrHeaders(37)
If Dir(STRFOLDER, 16) = "" Then
MsgBox "Der Ordner " & STRFOLDER & " wurde nicht gefunden!", 64, "Hinweis"
Exit Sub
End If
Application.ScreenUpdating = False
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(STRFOLDER)
intColumn = 1
For bytIndex = 0 To 37
arrHeaders(bytIndex) = objFolder.GetDetailsOf(varNAME, bytIndex)
Cells(1, intColumn + bytIndex) = arrHeaders(bytIndex)
Next
Rows(1).Font.Bold = True
lngRow = 2
For Each varNAME In objFolder.Items
If Right(varNAME, 3) = "xls" Then
With ActiveSheet
.Hyperlinks.Add .Cells(lngRow, 1), varNAME.Path, , , varNAME.Name
For bytIndex = 1 To 37
.Cells(lngRow, intColumn + bytIndex) = objFolder.GetDetailsOf(varNAME, bytIndex)
Next
lngRow = lngRow + 1
End With
End If
Next
Columns.AutoFit
Set objShell = Nothing
Set objFolder = Nothing
Application.ScreenUpdating = True
End Sub