取得 FILE 的 資訊(VBA)
Sub Get_file_info()
Dim myFso As Scripting.FileSystemObject
Dim myStr As String
Set myFso = New Scripting.FileSystemObject
With myFso.GetFile(ThisWorkbook.Path & "General.txt") 'FILE FOR CHECKING
Debug.Print "製作日:" & .DateCreated
Debug.Print "最後存取日:" & .DateLastAccessed
Debug.Print "最後更新日:" & .DateLastModified
Debug.Print "Root磁碟機名:" & .Drive
Debug.Print "檔案名稱:" & .Name
Debug.Print "上層資料夾名稱:" & .ParentFolder
Debug.Print "路徑:" & .Path
Debug.Print "DOS用短名稱:" & .ShortName
Debug.Print "DOS用短路徑:" & .ShortPath
Debug.Print "大小:" & (.Size / 1024) & "KB"
Debug.Print "類型:" & .Type
End With
Set myFso = Nothing 'RELEASE ALL
End Sub
沒有留言:
張貼留言