Sirocco
asked on
VBA macro to create mp3 list
Can the VBA macro for Word handle the following task: create lists of mp3 files, i.e. scan specified drives or folder for mp3 files(mp3, ogg), to decode the information(from ID3 tags) that is stored on each .mp3 file (artist, album, year, size), extract this data and create playlists based on this data? The lists will be stored as .M3Us (standard playlist format for MP3s).
ASKER
well, and how implement this to handle full task- i.e. scan specified drives or folders and create numbered lists of mp3 files?
Something like this can be used to get the info into a ListBox:
'add a reference to "Microsoft Scripting Runtime"
Dim fso As Scripting.FileSystemObject
Dim fld As Folder
Dim file As file
Dim id3 As ID3Tag
Set fso = New FileSystemObject
'Set this to be the folder to scan
Set fld = fso.GetFolder("C:\Document s and Settings\Me\My Documents\My Music\")
ListBox1.Clear
ListBox1.ColumnCount = 3
'loop through each file in the folder
For Each file In fld.Files
'it it's an MP3, add it to the list
If file.Type Like "MP3 audio file*" Then
'grab the ID3 info
Call GetID3Tag(fld.Path & "\" & file.Name, id3)
ListBox1.AddItem file.Name
ListBox1.List(ListBox1.Lis tCount - 1, 1) = id3.Artist
ListBox1.List(ListBox1.Lis tCount - 1, 2) = id3.Year
End If
Next
'add a reference to "Microsoft Scripting Runtime"
Dim fso As Scripting.FileSystemObject
Dim fld As Folder
Dim file As file
Dim id3 As ID3Tag
Set fso = New FileSystemObject
'Set this to be the folder to scan
Set fld = fso.GetFolder("C:\Document
ListBox1.Clear
ListBox1.ColumnCount = 3
'loop through each file in the folder
For Each file In fld.Files
'it it's an MP3, add it to the list
If file.Type Like "MP3 audio file*" Then
'grab the ID3 info
Call GetID3Tag(fld.Path & "\" & file.Name, id3)
ListBox1.AddItem file.Name
ListBox1.List(ListBox1.Lis
ListBox1.List(ListBox1.Lis
End If
Next
ASKER
I find some solution that list files in specified folder:
http://support.microsoft.com/?kbid=306248
How to make a small adjusting of this code:
1. list only file name - without full path, i.e. 'Rainbow.mp3'
(Currently macro list full path - C:\Documents and Settings\User\My Documents\mp3utilities\Rai nbow.mp3 )
2. show file size in Megabytes, not bytes
3. to number the list of files (01, 02..)
4. to adjust distance between columns
5. to set preffered font name and size
http://support.microsoft.com/?kbid=306248
How to make a small adjusting of this code:
1. list only file name - without full path, i.e. 'Rainbow.mp3'
(Currently macro list full path - C:\Documents and Settings\User\My Documents\mp3utilities\Rai
2. show file size in Megabytes, not bytes
3. to number the list of files (01, 02..)
4. to adjust distance between columns
5. to set preffered font name and size
ASKER
Please refund my points. I find macro http://support.microsoft.com/?kbid=306248
which just should be adjusted to meet my needs.
which just should be adjusted to meet my needs.
ASKER
Please close my question.
ASKER
Please close my question.
ASKER
Please close my question and refund points.
ASKER
Please close my question and refund points.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Extract the ID3 Tag from an mp3 File
http://www.freevbcode.com/ShowCode.Asp?ID=1118