Solved

Getting the creation date of a file

Posted on 2003-11-09
4
425 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

778 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