AllExperts > Experts 
Search      

Excel

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Excel Answers
Question Library

Ask a question about Excel
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Stuart Resnick
Expertise
I can answer any question relating to MS Excel formulas, or to programming with vba (Visual Basic for Applications) in the Excel environment

Experience
As a consultant, I've designed Excel tools since the 90s, working for the Federal Reserve Bank, AT&T, and (currently) Gap Inc.

 
   

You are here:  Experts > Computing/Technology > Business Software > Excel > Access the Date Picture Taken attribute

Topic: Excel



Expert: Stuart Resnick
Date: 10/19/2006
Subject: Access the Date Picture Taken attribute

Question
Hello,
Using VBA (Windows XP and Excel 2003) is it possible to retreive the value of the "Date Picture Taken" attribute of a picture file.

Thank you

Answer
If, for instance, you have on your drive a picture in .jpg format, you can use vba to retreive the date that .jpg file was created. This can also be done with any other type of file. Here's code that will prompt you to browse to a .jpg file, and will then put the date of that file in cell B2.

Before running the code, from within any module of the Visual Basic Editor, you should choose from the main menu Tools, References and make sure that "Microsoft Scripting Runtime" is checked.

Sub getFileDate()
 Dim filePath As String
 Dim fso As Scripting.FileSystemObject
 Dim file As Scripting.file
 filePath = Application.GetOpenFilename( _
   "Picture (*.jpg), *.jpg")
 Set fso = New FileSystemObject
 Set file = fso.GetFile(filePath)
 Range("b2") = file.DateCreated
End Sub

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.