PDA

View Full Version : Search Folder looking for File Tags



fb7894
01-23-2014, 03:43 PM
Hello.
I need write a VBA procedure which will search all files within a folder. But instead of searching for file names, I want to search for File Tags.

So, for example, I'd want to return the names of all files in my folder where the Tag = "Van Halen" regardless of what the name of the file is. Is this possible?

Thank you.

Kenneth Hobs
01-23-2014, 08:17 PM
I am not sure what you mean by tag. You can use this method to get details of (properties) for files. http://vbaexpress.com/kb/getarticle.php?kb_id=405

Other methods you might want to consider are listed at: http://www.cpearson.com/excel/docprop.htm

snb
01-24-2014, 04:36 AM
Since 'Van Halen' might be the 'artist' tag of that mp3 file:


sub M_snb()
sn=split(createobject("wscript.shell").exec("cmd /c Dir ""G:\OF\*.mp3"" /b").stdout.readall,vbcrlf)

for j=0 to ubound(sn)
With CreateObject("shell.application").namespace("G:\OF\")
if .getdetailsof(.Items.Item(sn(j)), 16)="Van Halen" then msgbox sn(j)
End With
next
End Sub

Caveat: each Windows version uses it's own numbers for 'tags'.
The artist in XP appears to be number 16.