mit diesem Code lese ich alle CFG-Dateien eines Ordners ein. Soweit alles in Ordnung.
Sub CFG_Files_List()
Dim strOrdner As String, strDatei As String
Dim lngZ As Long
lngZ = 3
Range("A3:D" & Range("A65536").End(xlUp).Row).ClearContents
strOrdner = "M:\Vorlagen\BA-SAR01\Einstellungen\projects\"
strDatei = Dir(strOrdner & "*.cfg")
If strDatei "" Then
Cells(lngZ, 1) = strOrdner & strDatei 'Pfad
Cells(lngZ, 2) = FileLen(strOrdner & strDatei) 'Größe
Cells(lngZ, 3) = FileDateTime(strOrdner & strDatei) 'Datum/Zeit
Cells(lngZ, 4) = strDatei 'nur Dateiname
lngZ = lngZ + 1
Do While strDatei ""
strDatei = Dir
If strDatei "" Then
Cells(lngZ, 1) = strOrdner & strDatei
Cells(lngZ, 1).Hyperlinks.Add Anchor:=Cells(lngZ - 1, 1), Address:=Cells(lngZ - 1, _
1), ScreenTip:=Cells(lngZ, 1).Text, TextToDisplay:=Cells(lngZ - 1, 1).Text
Cells(lngZ, 2) = FileLen(strOrdner & strDatei)
Cells(lngZ, 3) = FileDateTime(strOrdner & strDatei)
Cells(lngZ, 4) = strDatei
Cells(lngZ, 4).Hyperlinks.Add Anchor:=Cells(lngZ - 1, 4), Address:=Cells(lngZ - 1, _
1), ScreenTip:=Cells(lngZ - 1, 4).Text, TextToDisplay:=Cells(lngZ - 1, 4).Text
lngZ = lngZ + 1
End If
Loop
End If
End Sub
Was muss ich bitte im Code erweitern, wenn 15 weitere Pfade bei der Auflistung berücksichtigt werden sollen?
Beste Grüße,
Sergej