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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning the properties of a file

Status
Not open for further replies.

GSMike

Programmer
Feb 7, 2001
143
US
Could you please tell me how to return the following properties:

Last Accessed
Size

through VB code?

Thank you for your help. I need this bad!!!!

-Mike Mike Kemp
kempm541145@yahoo.com
 
Option Explicit
Dim fso As FileSystemObject

Private Sub Command1_Click()
Dim ofile As Scripting.File
Dim sfile As String
sfile = "C:\programing\David\Database\Accounting.mdb" 'put the name of your file here
Set fso = New FileSystemObject
Set ofile = fso.GetFile(sfile)
MsgBox ofile.DateCreated, , "Date Created"
MsgBox ofile.DateLastAccessed, , "Date Last Assessed"
MsgBox ofile.DateLastModified, , "Date Last Modified"
MsgBox ofile.Size, , "File Size"
MsgBox ofile.Type, , "File type"
End Sub

David Paulson


 
oh ya, you need to make reference to microsoft sripting runtime
David Paulson


 
That looks great.
Thank you, sir!! Mike Kemp
kempm541145@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top