Excel/Access the Date Picture Taken attribute
Expert: Stuart Resnick - 10/19/2006
QuestionHello,
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
AnswerIf, 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
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