0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBA フォルダの更新日時を取得 その2

Last updated at Posted at 2021-04-25
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

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?