Here is one more interesting VBA tool from the ExcelSirJi team. File Properties Tool is an Excel VBA tool that gets the following properties of the file.
'This function loops through all the files in the folder and
'gets the properties of each file and displays them on the sheet
Public Sub GetFileProperties()
'Variable Declaration
Dim objFS As Object
Dim objFile As Object
Dim strPath As String
Dim vFile As Variant
Dim iCurRow As Integer
'Clear old data from the sheet
Sheet1.Range("C7:H" & Sheet1.Rows.Count).ClearContents
'Set the path of the folder
strPath = Sheet1.Range("C3").Value
'Add slash at the end of the path
If Right(strPath, 1) <> "/" And Right(strPath, 1) <> "\" Then
strPath = strPath & "\"
End If
'Set Directory to folder path
ChDir strPath
vFile = Dir(strPath & "*.*") 'Change or add formats to get specific file types
'Set the variable to FileSystemObject
Set objFS = CreateObject("Scripting.FileSystemObject")
iCurRow = 7
Do While vFile <> "" 'LOOP until all files in folder strPath have been looped through
Set objFile = objFS.getfile(vFile)
'File name
Sheet1.Cells(iCurRow, 3).Value = objFile.Name
'Date Created
Sheet1.Cells(iCurRow, 4).Value = objFile.DateCreated
'Date Last Accessed
Sheet1.Cells(iCurRow, 5).Value = objFile.DateLastAccessed
'Date Last Modified
Sheet1.Cells(iCurRow, 6).Value = objFile.DateLastModified
'Size
Sheet1.Cells(iCurRow, 7).Value = Round(objFile.Size / 1024 / 1024, 2)
'Type
Sheet1.Cells(iCurRow, 8).Value = objFile.Type
vFile = Dir
iCurRow = iCurRow + 1
Loop
End Sub
We hope that you loved this article and tool. Please share this with your friends and share your feedback, views in below comment box.Looking forward to see you again.
Note: ExcelSirJi team works hard to help it’s subscribers and visitors to make full use of the free templates. As part of this objective, you are free to use this template. To get unprotected copy, you may refer the below link.
VBA Code to Convert MM.DD.YYYY To DD.MMM.YYYY in Excel In different parts of the world, there are different languages spoken and written. With this, a VBA programmer also faces language related issues while writing a…
Outlook Email Management Tool is an Excel based tool which works with Outlook 2010 or above version and helps you to read, copy or move multiple emails from an Outlook folder and sub-folders on click of a button. The tool also supports extracting attachments from emails as well.
Have you ever felt that Microsoft should have added a formula in Excel which can count the cells based on specific color? I have seen many code requests to share a VBA code that can count the cells by its color. To help our subscribers and developers, we are sharing 2 codes that be used to count the cells with specific color and returns the count of the matching color cells.
How to Find Duplicate Files In excel using VBA? Yesterday I was working on my computer and cleaning the drives to make some more space. I was surprised to see so many files saved at…
QR Code Generator Tool in Excel Hi Friends, today we are going to learn something which is more closure to many businesses. As the businesses going global and digital, there is a need to adopt…
How to send bulk emails from outlook using excel VBA? Have you ever felt the need of an Excel based VBA tool or code which can help you to draft Outlook emails in bulk by…
It’s just what I need, but the download does not work.
Thank you Michela,
Could you please try now? Its working else you may download the same from here also. Happy Reading 🙂
https://excelsirji.com/wp-content/uploads/2018/11/File-Properties-Tool.zip
Your Excel Mate
Now it works perfectly. Thank you very much for your prompt reply!
Hi. Is there any chance to get unprotected version?
Hello Jed,
Please accept our apologies for delay in response.
As you know that we at ExcelSirJi works hard to help our subscribers and visitors to make full use of the free codes and templates published by our team.
As part of our objective, you are free to use these templates. However to access the code, you may refer the below link to get unprotected version.
https://www.excelsirji.com/file-properties-tool-business-version/
Regards,
Your Excel Mate
This is a good bit of code. What I am struggling with is to amend the code to carry on the search in all subfolders. Ideally I’d love some code that would allow me to look for all Purchase Orders files containing “(SPO)” and to list them as you have here with a hyperlink on the file name. Again ideally this files contains field, would be a user typed variable, so we could look at all acknowledgements “(ACK)” or project references etc
Hi Paul,
Looking at your requirements, you may be interested in the File Manager Tool.
https://www.excelsirji.com/file-manager-tool-business-version/
Regards,
ExcelSirJi Team