Sub Test()
Dim i, j, k, arr, brr, x, y
Dim fs, fd, f, strPath
Set fs = CreateObject("scripting.filesystemobject")
Set fd = Application.FileDialog(msoFileDialogFilePicker)
If fd.Show = -1 Then
strPath = fd.SelectedItems(1)
Else
Exit Sub
End If
ReDim arr(1 To 1, 1 To 7)
Set f = fs.getfile(strPath)
With Sheet1
x = .Cells(Rows.Count, 1).End(xlUp).Row
arr(1, 1) = x - 1
arr(1, 2) = fs.GetBaseName(strPath)
arr(1, 3) = Replace(fs.getfilename(strPath), arr(1, 2) & ".", "")
arr(1, 4) = f.Size
arr(1, 5) = f.DateCreated
arr(1, 6) = f.DateLastModified
arr(1, 7) = f.DateLastAccessed
.Cells(x + 1, 1).Resize(1, UBound(arr, 2)) = arr
End With
End Sub |