ファイルの作成日時などを取得するマクロです。
例
ファイルの種類を取得するには、FileSystemObjectのGetFileでファイルオブジェクトを取得し、そのTypeプロパティからファイルの種類を取得します。※このFileSystemObjectを使うには、あらかじめ参照設定で「Microsoft Scripting Runtime」にチェックを入れておく必要があります。

Sub GetFileCreatedDate()
Dim fso As New FileSystemObject
Dim filePath As String
Dim message As String
filePath = "C:\work\image1\cccc.jpg"
message = filePath & vbCrLf & vbCrLf & _
"作成日時:" & fso.GetFile(filePath).DateCreated & vbCrLf & _
"最終アクセス日時:" & fso.GetFile(filePath).DateLastAccessed & vbCrLf & _
"最終更新日時:" & fso.GetFile(filePath).DateLastModified & vbCrLf
MsgBox message, vbInformation, "FileSystemObject"
End Sub
実行結果

comments powered by Disqus
スポンサーリンク