File Properties

G

Guest

I notice that it is possible in windows explorer to attached comments and
other fields to JPEG files.

Is it possible to read those comments using excel VBA? What about writing
them?

I am considering using some of the property fields (eg comments, keywords,
titles, authors etc) to store info on our photos but I would like to be able
to extract into excel and ideally update the fields from excel.

Any help welcome, Kaval
 
G

Guest

I've downloaded & installed the file and I can see the references I need in
the object browser.
Now I just need the VBA code to use it.

For example, if I want to read the SummaryProperties.Comments for the file
"C:\Photo1.jpg"
 
M

Michel Pierron

Hi Kaval,
You can try:

Private Sub FileInfo(iPath$, iFile$)
Dim i As Byte, u As Byte, Item$, Info
With CreateObject("Shell.Application").NameSpace(CStr(iPath))
For i = 0 To 34
Info = .GetDetailsOf(.ParseName(iFile), i)
Item = .GetDetailsOf(.Items, i)
If Len(Info) And Len(Item) Then
u = u + 1
Cells(u, 1) = .GetDetailsOf(.Items, i)
Cells(u, 2) = Info
End If
Next i
End With
End Sub

Sub Test()
Const P$ = "Path of My file name"
Const F$ = "My file name"
Call FileInfo(P, F)
End Sub

Regards,
MP
 
G

Guest

Thanks Michael, that works!

If I may, 2 further questions:

1) That code is not returning the Keywords field from the file properties.
Is it possible to get that as well?

2) How can I adapt to write to the file properties from excel?

Many thanks, Kaval
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top