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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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