Be the first user to complete this post

  • 0
Add to List

FileSystemObject : GetFile Method

Description: 

Returns a file object corresponding to the file in a specified path.

Format : 

objectOfFileSystemObject.GetFile(filespec)

objectOfFileSystemObject: As the name says, it’s a FileSystemObject.

Arguments: 
  • filespec
    • Mandatory
    • Type:     String
    • Specific file path
Function FnGetFile(strSpecificFilePath)

    Set fso = CreateObject("Scripting.FileSystemObject")

    Set file = fso.GetFile(strSpecificFilePath)

   s = file.Path & "<br>"

   s = s & "Created: " & file.DateCreated & "<br>"

   s = s & "Last Accessed: " & file.DateLastAccessed & "<br>"

   s = s & "Last Modified: " & file.DateLastModified  

End Function

 Call FnGetFile ("c:\New Folder\file.txt")



Also Read:

  1. FileSystemObject : GetParentFolderName Method
  2. FileSystemObject : GetDriveName Method
  3. FileSystemObject : CreateFolder Method
  4. FileSystemObject : GetFolder Method
  5. FileSystemObject in Excel Macro
  6. FileSystemObject : DeleteFile Method
  7. FileSystemObject : GetAbsolutePathName Method