Renaming a file and displaying Drive & File Information
Sub ShowFileAccessInfo()
Dim fs, f, s
On Error GoTo ShowFileAccessInfo_Err
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.Getfile("C:\mytext.txt")
s = f.Name & " on Drive " & UCase(f.Drive) & vbCrLf
'renames the file named c:\mytext.txt as yourtext.txt
f.Name = "yourtext.txt"
s = s & "New Name: " & f.Name & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"
ShowFileAccessInfo_Exit:
Exit Sub
ShowFileAccessInfo_Err:
MsgBox Err.Description, , "ShowFileAccessInfo"
Resume ShowFileAccessInfo_Exit
End Sub
Next >> Display Path and File Info.








