kevin.philips
Active Member
- Joined
- Jan 7, 2003
- Messages
- 364
Hi,
I have borrowed the code below from the Excel forum, how do I adapt it so that whenever I open my database it will run the macro.... I can do without displaying it on a form but would like the results displayed in a table - just the artist and song title will do.
Please help
Regards
Kevin
Doh:
I have borrowed the code below from the Excel forum, how do I adapt it so that whenever I open my database it will run the macro.... I can do without displaying it on a form but would like the results displayed in a table - just the artist and song title will do.
Please help
Regards
Kevin
Doh:
Code:
Option Explicit
Public Type mp3Info
Header As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 30
Genre As Byte
End Type
Sub Getmp3Info()
Dim mp3ID As mp3Info
Dim lngRow As Long, lngFile As Long
Dim lngFileCnt As Long
With Application.FileSearch
.NewSearch
.Filename = "*.MP3"
.LookIn = "C:\Documents and Settings\Kevin Philips\My Documents\My Music\Mp3" 'Change this to the folder you wish to search
.SearchSubFolders = True
.Execute
For lngFileCnt = 1 To .FoundFiles.Count
lngFile = FreeFile
Open .FoundFiles(lngFileCnt) For Binary As lngFile
Get lngFile, LOF(1) - 127, mp3ID
Close lngFile
If mp3ID.Header = "TAG" Then
ActiveCell.Offset(lngRow, 0) = .FoundFiles(lngFileCnt)
With mp3ID
ActiveCell.Offset(lngRow, 1) = .Title
ActiveCell.Offset(lngRow, 2) = .Artist
ActiveCell.Offset(lngRow, 3) = .Album
ActiveCell.Offset(lngRow, 4) = .Year
ActiveCell.Offset(lngRow, 5) = .Genre
ActiveCell.Offset(lngRow, 6) = .Comment
End With
lngRow = lngRow + 1
End If
Next
End With
End Sub