Need VBA Help regarding windows explorer

pja101

Board Regular
Joined
Nov 29, 2006
Messages
51
Is anyone familiar with macro code that would allow me to see attributes such as file name, file size, date created, etc. from windows explorer in an excel sheet?
Thanks. :lol:
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
This code will list the items you mentioned on the active page.
Code:
Sub fileInfo()
Dim wb As Workbook, _
fileObj As Object
Set wb = ActiveWorkbook
Set fileObj = CreateObject("Scripting.FileSystemObject")
[A1].Value = "Created:"
[A2].Value = "Modified:"
[A3].Value = "Accessed:"
[A4].Value = "File Size:"
[A5].Value = "File Name:"
[B4].NumberFormat = "#,##0"
[B1].Value = fileObj.GetFile(wb.FullName).DateCreated
[B2].Value = fileObj.GetFile(wb.FullName).DateLastModified
[B3].Value = fileObj.GetFile(wb.FullName).DateLastAccessed
[B4].Value = fileObj.GetFile(wb.FullName).Size
[B5].Value = fileObj.GetFile(wb.FullName).Name
Set fileObj = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top