Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Attributes Help

Status
Not open for further replies.

vich

Technical User
Sep 26, 2000
107
US
I've searched and searched and can not figure this out.

I want to import the file name, date modified and subject for files in a spedified directory into a table.

What I can't figure out is how to get the date modified and subject information. Can anyone please point me in the right direction if it is possible.

Many Thanks!!!
 
The file and folder will hold that information.

Code:
dim fle as file
dim fld as folder

set fld="c:\yourpath"

for each fle in fld.files

debug.print fle.DateCreated

next

HTH

Play around with that some and see where if it helps.

I tried to have patience but it took to long! :) -DW
 
Oh yeah...almost forgot. You need to reference Microsoft Scripting Runtime for this to work.



I tried to have patience but it took to long! :) -DW
 
jadams0173 - tried your suggestion get error "Compile error: Type mismatch" on the statement

Set fld = "c:\0d"

Am I missing something?

Thanks
 
Sorry. I didn't test the code. Here is some that is tested and will tell you the date last modified.

Code:
Function DTModified()
Dim fle As File
Dim fld As Folder
Dim fso As FileSystemObject

Set fso = New FileSystemObject

Set fld = fso.GetFolder("C:\TEMP")

For Each fle In fld.Files

Debug.Print fle.DateLastModified

Next
Set fld = Nothing
Set fso = Nothing

End Function

As for the subject infomation I don't think the FSO will help you with that piece of the puzzle.

I tried to have patience but it took to long! :) -DW
 
Not sure. That's why I ended my last post as such. I was hoping to get the OP started on something.

I tried to have patience but it took to long! :) -DW
 
PHV
Thanks for the reply I am still trying to figure out based on your first reply(Thanks) I saw jadams post which looked simple-no success though.

I don't see where FSO can supply the file attribute "subject" though. Am I missing something?
 
This is from the VB 6 forum but I think it is what you want. I haven't tested either
thread222-1101783

I tried to have patience but it took to long! :) -DW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top