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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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,223,275
Messages
6,171,119
Members
452,381
Latest member
Nova88

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