In Windows Explorer, I can select a file, go to properties, and under 'summary', I can input keywords into the description, for use later when searching for the file.
I would like to be able to read/write these file keywords via VBA.
I assume I need to access the Windows API, but more than that, not sure what library etc. I would need to use.
Can anyone advise me how do to this
best regards,
Dog-san

Custom file description keywords: read/write in VBA via API
Tie2000
As to the partner’s reply, I’ve done the some research and following is my solution:< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Actually, it is not because of the difference between Office file and Non-Office file that cause the “Can not read keyword property” issue. It is because of that the JPEG format has its own storage for the keywords and title fields. You can just do a test, create a .txt file which is not an Office file, and you can also modify the keywords field via the tool I send to you last time. On the other hand, JPEG has its own format that can contain the summary information instead of the NTFS file system, so we can not read it out by the DsoFile, or you can create a GIF file, it simply doesn’t have any summary information fields at all. So regarding some special file format like JPEG or MP3 that can contain the summary file information itself, the only way we can do is to develop the “Summary Information Reader” case by case.
For instance, in JPEG format, we use EXIF tags for summary information storage, so if you want to access the summary filed of a JPEG file, you have to use the standard EXIF way, every EXIF tag has a Tag ID, as defined, the following is the Tag IDs for common properties:
9c9b = Title
9c9c = Comment
9c9d = Author
9c9e = Keywords
9c9f = Subject
And as a test, applying the above Tag IDs in the following sample VB.Net code, you can get the right summary info for the JPEG format:
Accessing Extra Image Information in JPEG Files
http://msdn.microsoft.com/library/en-us/dnhcvb04/html/vb04b15.asp
Or in VB, you can use a EXIF utility JHead to fetch such information, it is also mentioned in the article.
I hope this helps!
-brenda (ISV Buddy Team)
Andrew Wilkes
m-atmakuri
According to your partner’s problem, I’ve found the following source code in Visual Basic for him, it will be very easy for him to translate it into VBA. If your partner does not know how to translate it into VBA, please tell me what VBA he is using, for ex, VBA for Word, or VBA for Excel, or even VBA in Project, etc…. After knowing the specific VBA version, I can help to translate the code into VBA if he wants.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
The file package attached contains the source code to access the file summary both in VB6 code and VB.Net code, an ActiveX control that named DsoFile.dll should be registered so that we can access it, please follow the instructions in the following link to do that:
Dsofile.dll lets you edit Office document properties without Office in Visual Basic .NET 2003 and in Visual Basic .NET 2002
http://support.microsoft.com/ id=224351
Please reply here if you need any additional assistance.
thanks!
-brenda (ISV Buddy Team)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
urbancenturion
Actually, your suggested method only addresses part of what I am hoping to do.
I believe your suggested method address reading file properties of OFFICE files, but I was also hoping for a method that would be able to deal with other file types (JPEG, MP3, etc.)
I have tried manually setting properties (such as 'keyword') on JPEGs, and when I open them with the sample applications based on DSOFILE.DLL, they are displayed, but the keyword field is shown as blank, whereas when I display the same data using Windows Explorer, the values I wrote into the 'keyword' field is shown properly.
Should DSOFILE.DLL be able to read/write non-office files also
best regards,
Dog-san
BobGun
I was hoping to find the translation form the VB6 or VB7 code for the dsofile.dll samples, but the translation was never posted. Can you ask whemever you were talking to (one of your international support engineers) to post a sample translation to VBA for Excel (Excel 11.0).
speciffically, I'm interested in the custom properties functionality and I only need to read the information (no writing required).
TIA
Lee
Arnauld
As far as I know, there is a specification for EXIF field reference from external internet as following, however, the EXIF fields are not defined by Microsoft and some applications may add custom unknown field for internal usage, so I have to say there may not be a perfect complete list. You may take it as a reference at http://www.hugsan.com/EXIFutils/Documentation/EXIFutils-FieldRef.pdf
thanks,
-brenda (ISV Buddy Team)
joceryl
Is there a complete list of metadata tags that will be added to Exif JPEG image files In a previous message identified Tag IDs for Title (9c9b), Comment (9c9c ), Author (9c9d ), Keywords (9c9e), and Subject(9c9f ) common properties
< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I have found 11 metadata tags that are unknown to the Exif 2.21 defined metadata:
1) Tag ID 4097 contains what happens to be the Image Width
2) Tag ID 4098 contains what happens to be the Image Height
3) Tag ID 18246 or 0x4746 that through experimentation contains a Rating
4) Tag ID 18247 or 0x4747 contained the following Unicode :
<Labels>
<Word title="KeywordRoot">
<Word title="airport">
</Word>
<Word title="Hawaii">
</Word>
</Word>
<Word title="PeopleRoot">
</Word>
<Word title="LocationRoot">
</Word>
<Word title="EventRoot">
</Word>
<Word title="SyncRoot">
</Word>
</Labels>
5) Tag 40091 or 0x9C9B that was identified as Title and it contains a unicode stream that contains '100-0003_IMG'
6) Tag 40094 or 0x9C9E that was identified as Keywords and it contains a unicode stream that contains 'Hawaii, airport'
7-9)Tags 41985(0xA401),41986(0xA402),and 41987(0xA403) all have a value of zero
10) Tag 41988 (0xA404) is a rational with a value of 2272/2272 or 1.0
11) Tag 41990 (0xA406) has a value of 0
Deadlock42440
Here's the engineer's response:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbaxl11/html/xlobjCustomProperties_HV03080858.asp
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbawd11/html/woobjCustomProperties_HV03084108.asp
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbawd11/html/woobjCustomProperties_HV03084108.asp
'edit "complete" custom property value
Application.ActivePresentation.CustomDocumentProperties _
.Add Name:="Complete", LinkToContent:=False, _
Type:=msoPropertyTypeBoolean, Value:=False
With Application.ActivePresentation
If .CustomDocumentProperties("complete") = False Then Debug.Print "false"
End With
wksSheet1.CustomProperties.Add _
Name:="Market", Value:="Nasdaq"
With wksSheet1.CustomProperties.Item(1)
MsgBox .Name & vbTab & .Value
End With
-brenda (ISV Buddy Team)