Folder Modified Date

K

Karen

I have following vba

With Dialogs(wdDialogCopyFile)
If .Display() <> -1 Then Exit Sub
MyPath = .Directory
End With

which chooses a folder that I'll be pulling files out of. How can I
retrieve the modified date of that folder?
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Karen,

AFAIK, folders do not have a "modified date" property. While there is a
"created date" property, I guess that is not what you want.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 
K

Karen

Doug,

When I look in Explorer it lists the folder name, its size and the modified
date. I need the date or perhaps the date of the first file in the
directory. Any ideas?


--
Karen
"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
Hi Karen,

AFAIK, folders do not have a "modified date" property. While there is a
"created date" property, I guess that is not what you want.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 
C

Charles Kenyon

That may be the latest modified date of files within the directory. Just a
guess.
;)


--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

Karen said:
Doug,

When I look in Explorer it lists the folder name, its size and the modified
date. I need the date or perhaps the date of the first file in the
directory. Any ideas?
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Karen,

While that is what the heading of the column says, I believe that it really
only applies to the files in the folder. If you right click on the folder
itself and select properties, you will see that the date shown under the
Date Modified heading is the same as the "Created:" date in the Properties
dialog.

The following is another way to enable the user to browse for a folder and
to return the path and the "modified = created" date of the folder:

Dim oShell As Shell32.Shell
Dim oFolder As Shell32.Folder
Dim ofolderitem As Shell32.FolderItem
Dim EverythingOK As Boolean
EverythingOK = False
Set oShell = New Shell32.Shell
Set oFolder = oShell.BrowseForFolder(0, "Select ", 0)
On Error GoTo NoPath
MsgBox oFolder.Self.Path
MsgBox oFolder.Self.ModifyDate
EverythingOK = True
NoPath:
Set oFolder = Nothing
Set oShell = Nothing
If EverythingOK Then Exit Sub
On Error GoTo 0
MsgBox "Action cancelled by user.", vbExclamation, "Cancelled"

For the above to work, you will need to set a reference to the Microsoft
Shell Controls and Automation library under Tools>References in the VBE.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
Karen said:
Doug,

When I look in Explorer it lists the folder name, its size and the
modified
date. I need the date or perhaps the date of the first file in the
directory. Any ideas?
 
K

Karen

Found it

FileDateTime(MyFileName)

--
Karen
Charles Kenyon said:
That may be the latest modified date of files within the directory. Just a
guess.
;)


--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top