VBA macro to create mp3 list

Posted on 2005-03-23
Medium Priority
Last Modified: 2008-03-17
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).
Question by:Sirocco
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
LVL 32

Expert Comment

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

Extract the ID3 Tag from an mp3 File

Author Comment

ID: 13614062
well, and how implement this to handle full task- i.e. scan specified drives or folders and create numbered lists of mp3 files?
LVL 32

Expert Comment

ID: 13614065
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.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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 13614777
I find some solution that list files in specified folder:


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

Author Comment

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

Author Comment

ID: 13962366
Please close my question.

Author Comment

ID: 13976202
Please close my question.

Author Comment

ID: 13978306
Please close my question and refund points.

Author Comment

ID: 14078798
Please close my question and refund points.

Accepted Solution

modulo earned 0 total points
ID: 14395780
PAQed with points refunded (125)

Community Support Moderator

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question