Can I retrieve ‘Date Modified’ from a CSV file???

Rags

Board Regular
Joined
Oct 25, 2006
Messages
202
Hi

Is there any way to retrieve the ‘Date Modified’ from a CSV file? As far as I know this is not stored in such a file but the information is retained in Windows Explorer. Can I somehow access it from Excel and place it in a cell or assign to a variable?

Thanks for any help.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try this:
Code:
Sub ModifiedDate()
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(“C:/MyFile.csv”)
MsgBox f.DateLastModified
End Sub
Change the file path as appropriate.
 
Upvote 0
Thanks, that's really good.

Is there any way to format the date to: 22 August 2007 09:12:16
 
Upvote 0
Perhaps like this:
Code:
Sub ModifiedDate()
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile("C:\MyFile.csv")
Range("A1") = f.DateLastModified
Range("A1").NumberFormat = "dd mmmm yyyy hh:mm:ss"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,184
Members
448,949
Latest member
keycalinc

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