How to get the attribute of a directory?

VitaminB6

Board Regular
Joined
Oct 11, 2004
Messages
208
In my macro, I need to get the attribute of a directory, for example, I need to have the date of a directory. Can someone help me with this? Thank you.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Perhaps, something like this:

Sub test()
MsgBox DateValue(FileDateTime("C:\test"))
End Sub
 
Upvote 0
Hi HotPepper,

Thank you very much for your reply. This is realy want I am looking for. But, I have another question:
There are several sub-folders in a directory and I would like to run the sub-folders by time. What I mean is to run the sub-folder which time/date is earlier than the others.

In your example, it only shows date but not time. To get the time, TimeValue function can be used. However, is there a function which can get time + date?




Perhaps, something like this:

Sub test()
MsgBox DateValue(FileDateTime("C:\test"))
End Sub
 
Upvote 0
Thank again for your helps.
Below is one of the code and I am trying to seperate the day out. However, I failed.

LotDateForSK = DateValue(FileDateTime(PathForTime & myFileName))

The format of my calander system is 10/17/2006.
Tried to get the month out, below is the code used

Temp=Right(Left(LotDateForSK,4),2) ==>17

However, it fails when the date is 10/9/2006 but ==>/9

Anyone can help me with this?
 
Upvote 0

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

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