Solved

Getting the creation date of a file

Posted on 2003-11-09
4
426 Views
Last Modified: 2010-05-01
How would one get the creation date of a file in VB6?

   - Marc
0
Comment
Question by:MarcGraff
  • 3
4 Comments
 
LVL 11

Expert Comment

by:bingie
ID: 9710322

Add a command button and paste the following code

Private Sub Command1_Click()
   Dim filesys As Object
   Set filesys = CreateObject("Scripting.FileSystemObject")
   Set f = filesys.GetFile(filePath) 'filepath is your file's path
   MsgBox f.DateCreated
End Sub

(above is from AzraSound)
0
 
LVL 11

Accepted Solution

by:
bingie earned 250 total points
ID: 9710330
Oops - use this instead:

Private Sub Command1_Click()
  Dim f As Object
  Dim filesys As Object
  Set filesys = CreateObject("Scripting.FileSystemObject")
  Set f = filesys.GetFile(filePath) 'filepath is your file's path
  MsgBox f.DateCreated
End Sub
0
 
LVL 11

Expert Comment

by:bingie
ID: 9710337
Also, see this link for info on getting other file information

http://www.mvps.org/vbnet/code/fileapi/filedatetime.htm
0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9710579
Thanks so much!

   - Marc
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question