1

I have a number of JPEG image files (roughly 8,000!) that I would like to copy the properties for into excel - names of the files and time the specific photo was taken.

I'd love it if there was a quick and easy way to have this information copied over into separate cells, rather than me having to type them out individually. the format of the page is simple - three columns of Date, Time Taken and Name.

I am not a programmer at all, so the simplest solution (if any) and language would be most helpful!

Cheers

Community
  • 1
  • 1

1 Answers1

0

Why I wouldn't normally answer a code-less question I found this interesting.

On Windows 7 I can get the DateTaken using Shell below. I know from prior experience (see get list of subdirs in vba) the Detailsof can vary by OS.

Pls update the code below to point at your directory (currently c:\temp)

This works for me, but does leave additional characters (? or CHR63) in the date field that I'm yet to manage to clean)

Sub JPG_Details()

Dim objShell  As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim lngCnt As Long

'If StrDir is dimensioned as a string, ParseName fails. Weird but true
Dim strDir
Dim strFile As String
Dim X(1 To 10000, 1 To 3)


Set objShell = CreateObject("shell.application")
strDir = "C:\temp\"
Set objFolder = objShell.Namespace(strDir)

strFile = Dir(strDir & "*.jpg")

Do While Len(strFile) > 0
    lngCnt = lngCnt + 1
    Set objFolderItem = objFolder.ParseName(strFile)
    X(lngCnt, 1) = strFile
    X(lngCnt, 2) = Split(objFolder.GetDetailsOf(objFolderItem, 12), " ")(0)
    X(lngCnt, 3) = Split(objFolder.GetDetailsOf(objFolderItem, 12), " ")(1)
    strFile = Dir
Loop

[a1].Resize(UBound(X, 1), UBound(X, 2)).Value2 = X

End Sub
Community
  • 1
  • 1
brettdj
  • 54,857
  • 16
  • 114
  • 177