Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Seminars > Email > Lessons >
Back to Email Seminar Lessons    Comments List
Accessing file inform Lesson 7 Upload Images   Link   Email  
Sami Shamma              
11 months ago
Good mooring
I would like to get the file creation date from windows from my VBA code. Can I do that?

Many thanks
Kevin Robertson            
11 months ago
Yes. Here is a function to get the created date.

In Global Module
Public Function ShowFileInfo(filespec) As Date

    Dim fso As Object, f As Object, D As Date
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFile(filespec)
    D = f.DateCreated
    ShowFileInfo = D
    
    Set fso = Nothing
    Set f = Nothing
    
End Function


In Button Click Event
Dim createdDate As Date
    createdDate = ShowFileInfo("Full Path of Your File")
        
    MsgBox "Created: " & createdDate
Sami Shamma              
11 months ago

Sami Shamma              
11 months ago
Hi Kevin

I am getting the wrong date returned from my code!
What am I doing wrong?
Sami Shamma              
11 months ago
Sorry Kevin

It is working correctly. I was looking at the wrong date.

Many thanks again
Kevin Robertson            
11 months ago
I have tested it on several files and get the correct date. Are you sure it is Date Created that being displayed in File Explorer?
Right click on the file, then click on properties in the context menu.
Kevin Robertson            
11 months ago
OK. Glad it's working.
Sami Shamma              
11 months ago
Hi Again

What I need is the "Modified" date.
I tried to change the code to read:
       D = f.DateModified
but that did not work

Help!!
Kevin Robertson            
11 months ago
Almost correct. Use this:
D = f.DateLastModified
Sami Shamma              
11 months ago
Thanks, that worked.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Email Seminar Lessons.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/23/2024 1:31:04 AM. PLT: 1s