AboutStuart 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.
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