Zeitstempel
23.11.2020 10:14:27
Sarah
wie bekomme ich hier das Änderungsdatum der Datei in Spalte 20?
ich habs mit ".Cells(lngRow, 20).Value = FileDateTime(OWB)" probiert, aber dies hat nicht geklappt.
Public Sub test()
Dim strFile As String
Dim strPath As String
Dim strExt As String
Dim ZWB As Workbook
Dim OWB As Workbook
Dim lngRow As Long
strPath = "..."
strExt = "*.xlsx"
If strPath = "" Then Exit Sub
strFile = Dir$(strPath & strExt)
Do Until strFile = vbNullString
Set ZWB = ThisWorkbook
Set OWB = Workbooks.Open(Filename:=strPath & strFile)
'jede 10. Zeile eintragen
With ZWB.Worksheets("Import Bestellformular")
For lngRow = 2 To .Rows.Count Step 10
If IsEmpty(.Cells(lngRow, 1).Value) Then
'.Cells(lngRow, 20).Value = FileDateTime(OWB)
.Cells(lngRow, 1).Value = OWB.Worksheets(1).Range("C15").Value
.Cells(lngRow, 2).Value = OWB.Worksheets(1).Range("C60").Value
.Cells(lngRow, 3).Value = OWB.Worksheets(1).Range("D61").Value
.Cells(lngRow, 4).Value = OWB.Worksheets(1).Range("F61").Value
Workbooks(strFile).Worksheets(1).Range(Cells(32, 1), Cells(Range("O32").End( _
xlDown).Row, 15)).Copy 'Daten mit zummengefügten zellen
.Cells(lngRow, 5).PasteSpecial xlPasteValues
Exit For
End If
Next
End With
OWB.Close SaveChanges:=False
strFile = Dir$ ' nächste Datei
Loop
Set OWB = Nothing
End Sub