Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

VBA macro to create mp3 list

Posted on 2005-03-23
13
Medium Priority
?
581 Views
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).
0
Comment
Question by:Sirocco
  • 7
  • 2
10 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 13613497
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
0
 

Author Comment

by:Sirocco
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?
0
 
LVL 32

Expert Comment

by:Erick37
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.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
0
Independent Software Vendors: 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

by:Sirocco
ID: 13614777
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
0
 

Author Comment

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

Author Comment

by:Sirocco
ID: 13962366
Please close my question.
0
 

Author Comment

by:Sirocco
ID: 13976202
Please close my question.
0
 

Author Comment

by:Sirocco
ID: 13978306
Please close my question and refund points.
0
 

Author Comment

by:Sirocco
ID: 14078798
Please close my question and refund points.
0
 

Accepted Solution

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

modulo
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

578 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