Display selected file information
Private Sub cmdFileInfo_Click()
Dim myFileSystemObject As FileSystemObject, aFile As File
Set myFileSystemObject = New FileSystemObject
Set aFile = myFileSystemObject.GetFile("c:\test.txt")
With aFile
Debug.Print "Created: " & .DateCreated & vbCrLf
Debug.Print "Last Accessed: " & .DateLastAccessed & vbCrLf
Debug.Print "Last Modified: " & .DateLastModified & vbCrLf
Debug.Print "Size: " & Format(.Size / 1000#, "#0.00") & "KB" & vbCrLf
Debug.Print "Path: " & .Path & vbCrLf
Debug.Print "Type: " & .Type
End With
Set myFileSystemObject = Nothing
Set aFile = Nothing
End Sub
Related examples in the same category