AllExperts > Excel 
Search      
Excel
Volunteer
Answers to thousands of questions
 Home · More Excel 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 > Microsoft Software > Excel > Access the Date Picture Taken attribute

Excel - Access the Date Picture Taken attribute


Expert: Stuart Resnick - 10/19/2006

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

View Follow-Ups    Add to this Answer   Ask a Question


 
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.