Link to home
Start Free TrialLog in
Avatar of Sirocco
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).
Avatar of Erick37
Erick37
Flag of United States of America image

Here is sample code to read the ID3 tags from the files:

Extract the ID3 Tag from an mp3 File
http://www.freevbcode.com/ShowCode.Asp?ID=1118
Avatar of Sirocco
Sirocco

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:\Documents 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.ListCount - 1, 1) = id3.Artist
        ListBox1.List(ListBox1.ListCount - 1, 2) = id3.Year
    End If
Next
Avatar of Sirocco

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\Rainbow.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
Avatar of Sirocco

ASKER

Please refund my points. I find macro http://support.microsoft.com/?kbid=306248
which just should be adjusted to meet my needs.
Avatar of Sirocco

ASKER

Please close my question.
Avatar of Sirocco

ASKER

Please close my question.
Avatar of Sirocco

ASKER

Please close my question and refund points.
Avatar of Sirocco

ASKER

Please close my question and refund points.
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial