Sub test1()
Dim fso As FileSystemObject
Set fso = New FileSystemObject
' フォルダ
Dim fl1 As Folder
Set fl1 = fso.GetFolder("C:\Windows")
Dim d1 As Date
d1 = fl1.DateLastModified
With ActiveSheet
.Range("A1") = fl1.Name
.Range("B1") = d1
.Range("C1") = Hour(d1) & ":" & Minute(d1)
End With
' ファイル
Dim fl2 As File
Set fl2 = fso.GetFile("C:\Users\user\Documents\222.txt")
Dim d2 As Date
d2 = fl2.DateLastModified
With ActiveSheet
.Range("A2") = fl2.Name
.Range("B2") = d2
.Range("C2") = Hour(d2) & ":" & Minute(d2)
End With
Set fso = Nothing
End Sub
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme