Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Properties of a jpg

Hello Group,

Can one use VBA to extract certain properties of a jpg file that have
been added from Xp Explorer ?

I have collected tons of fine art images from web museums and I have
used the comment field in Explorer to record the year. While in
Explorer, I can easily sort the images in chronologiocal order.

I can display the art in Excel easily and I would like to extract any
information I place in the jpg.

Thanks,

Michael Singmin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default Properties of a jpg

Hi Michael,
You can try:

Sub TestExample()
MsgBox JpgComment("c:\MyFile.jpg")
End Sub

Private Function JpgComment$(sFile$)
With CreateObject("Shell.Application") _
..NameSpace(Left$(sFile, lPosition(sFile, "\") - 1))
JpgComment = .GetDetailsOf(.ParseName(Dir$(sFile)), 14)
End With
End Function

Private Function lPosition%(Chain$, Char$)
Dim iPos%
Do
iPos = InStr(lPosition + 1, Chain, Char, 1)
If iPos Then lPosition = iPos Else Exit Do
Loop
End Function

Regards,
MP

"Michael Singmin" a écrit dans le message de news:
...
Hello Group,

Can one use VBA to extract certain properties of a jpg file that have
been added from Xp Explorer ?

I have collected tons of fine art images from web museums and I have
used the comment field in Explorer to record the year. While in
Explorer, I can easily sort the images in chronologiocal order.

I can display the art in Excel easily and I would like to extract any
information I place in the jpg.

Thanks,

Michael Singmin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Properties of a jpg

Greetings Michel,

Your code is amazing and I have more questions.
How do I access values in other properties of the jpg ?
Eg. I use the Subject field to hold the art genre.

Looking at your code, does this imply one can also add information
into a jpg using VBA ?

Would you care to explain what is happening in your code ?
Is there a jpg document on the Net that documents that structure
of a jpg and how one accesses these values ?

Thanks,

Michael Singmin

================================================== ===========
"Michel Pierron" wrote:

Hi Michael,
You can try:

Sub TestExample()
MsgBox JpgComment("c:\MyFile.jpg")
End Sub

Private Function JpgComment$(sFile$)
With CreateObject("Shell.Application") _
.NameSpace(Left$(sFile, lPosition(sFile, "\") - 1))
JpgComment = .GetDetailsOf(.ParseName(Dir$(sFile)), 14)
End With
End Function

Private Function lPosition%(Chain$, Char$)
Dim iPos%
Do
iPos = InStr(lPosition + 1, Chain, Char, 1)
If iPos Then lPosition = iPos Else Exit Do
Loop
End Function

Regards,
MP

"Michael Singmin" a écrit dans le message de news:
...
Hello Group,

Can one use VBA to extract certain properties of a jpg file that have
been added from Xp Explorer ?

I have collected tons of fine art images from web museums and I have
used the comment field in Explorer to record the year. While in
Explorer, I can easily sort the images in chronologiocal order.

I can display the art in Excel easily and I would like to extract any
information I place in the jpg.

Thanks,

Michael Singmin



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default Properties of a jpg

Hi Michael,
If you only wish to obtain information of the Subject and Comments fields,
you can modify the JpgComment procedure as follows:

Private Function JpgComment$(sFile$)
With CreateObject("Shell.Application") _
..NameSpace(Left$(sFile, lPosition(sFile, "\") - 1))
JpgComment = .GetDetailsOf(.Items, 11) & ": " _
& .GetDetailsOf(.ParseName(Dir$(sFile)), 11) _
& vbLf & .GetDetailsOf(.Items, 14) & ": " _
& .GetDetailsOf(.ParseName(Dir$(sFile)), 14)
End With
End Function


If you wish to obtain existing information for the whole of the headings,
you can proceed as follows:

Sub TestExample()
MsgBox FileInfo("c:\YourFile.jpg")
End Sub

Private Function FileInfo$(sFile$)
Dim i%, T$
With CreateObject("Shell.Application") _
..NameSpace(Left$(sFile, lPosition(sFile, "\") - 1))
For i = 0 To 34
T = .GetDetailsOf(.ParseName(Dir$(sFile)), i)
If Len(T) Then
If i Then FileInfo = FileInfo & vbLf
FileInfo = FileInfo & .GetDetailsOf(.Items, i) & ": " & T
End If
Next i
End With
End Function

Private Function lPosition%(Chain$, Char$)
Dim iPos%
Do
iPos = InStr(lPosition + 1, Chain, Char, 1)
If iPos Then lPosition = iPos Else Exit Do
Loop
End Function


With vba, if you wish to write your own information, it is much more
complicated because you must know the heading structure of the file.

Regards,
MP

"Michael Singmin" a écrit dans le message de news:
...
Greetings Michel,

Your code is amazing and I have more questions.
How do I access values in other properties of the jpg ?
Eg. I use the Subject field to hold the art genre.

Looking at your code, does this imply one can also add information
into a jpg using VBA ?

Would you care to explain what is happening in your code ?
Is there a jpg document on the Net that documents that structure
of a jpg and how one accesses these values ?

Thanks,

Michael Singmin

================================================== ===========
"Michel Pierron" wrote:

Hi Michael,
You can try:

Sub TestExample()
MsgBox JpgComment("c:\MyFile.jpg")
End Sub

Private Function JpgComment$(sFile$)
With CreateObject("Shell.Application") _
.NameSpace(Left$(sFile, lPosition(sFile, "\") - 1))
JpgComment = .GetDetailsOf(.ParseName(Dir$(sFile)), 14)
End With
End Function

Private Function lPosition%(Chain$, Char$)
Dim iPos%
Do
iPos = InStr(lPosition + 1, Chain, Char, 1)
If iPos Then lPosition = iPos Else Exit Do
Loop
End Function

Regards,
MP

"Michael Singmin" a écrit dans le message de news:
...
Hello Group,

Can one use VBA to extract certain properties of a jpg file that have
been added from Xp Explorer ?

I have collected tons of fine art images from web museums and I have
used the comment field in Explorer to record the year. While in
Explorer, I can easily sort the images in chronologiocal order.

I can display the art in Excel easily and I would like to extract any
information I place in the jpg.

Thanks,

Michael Singmin





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using properties Mrs. Smith Excel Discussion (Misc queries) 1 June 4th 07 05:37 PM
Sheet properties Name and (Name) nsv Excel Discussion (Misc queries) 2 January 24th 06 10:56 AM
Tab Properties JohnHill Excel Worksheet Functions 2 August 12th 05 04:38 AM
Custom Properties DavidW[_2_] Excel Programming 9 July 1st 04 03:31 PM
Arguments as properties BruceD[_2_] Excel Programming 4 June 11th 04 02:34 PM


All times are GMT +1. The time now is 05:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"