PDA

View Full Version : [SOLVED] When running a macro, Excel suddenly stops responding



D_Marcel
01-09-2014, 07:01 AM
Hello Masters!

Hope that everything is doing well with everybody.
I got from internet a simple and functional code to update MP3 tags by loading the extension cddbcontrol.dll. The problem is that the Excel always stops responding after some time of execution. I separated all my files in lots of 800. I could update the first one successfully, but now even with smaller lots, Excel suddenly stops responding and restarts.

Do you have an idea of what can cause this? This is the code:


Sub Updater()
Dim Register As Range
Dim ID3 As New CddbID3Tag
Set WorkArea = Plan1.Range(Cells(5, 1), Cells(Cells(Rows.Count, 1).End(xlUp).Row, 1))
RowCounter = Cells(Rows.Count, 1).End(xlUp).Row - 4
For Each Register In WorkArea
Counter = Counter + 1
Application.Wait Now + TimeValue("00:00:01")
Application.StatusBar = "Updating tags from file " & Counter & " of " & _
RowCounter & " | Progress : " & Format((Counter) / RowCounter, "Percent")
ID3.LoadFromFile Register.Value, False
ID3.Album = Register.Offset(0, 5).Value
ID3.Title = Left(Register.Offset(0, 2).Value, (Len(Register.Offset(0, 2).Value) - 4))
ID3.LeadArtist = Register.Offset(0, 4).Value
ID3.TrackPosition = Register.Offset(0, 3).Value
ID3.SaveToFile Register.Value
Next Register
End Sub

Yesterday after several attempts, the method SaveToFile stopped working, even restarting the machine.

Thanks in advance!

Kenneth Hobs
01-09-2014, 07:26 AM
You might want to use GetDetailsOf() instead. http://www.mrexcel.com/forum/excel-questions/322393-read-write-mp3-file-tag-properties-solved.html

D_Marcel
01-09-2014, 07:32 AM
Thanks Kenneth!

I'll try to use this one that you recommended.

D_Marcel
01-13-2014, 12:57 PM
Hello Masters,

Just to keep as register. After some researchs, I opted for use the application 'Tag & Rename', because I would have to search the internet the same way to find the informations of the tracks. With this one, you can mass update all tracks of an album, what makes the job easier in my opinion.

Kind regards

SamT
01-13-2014, 01:08 PM
D_Marcel,

Can you share your new code with us?

D_Marcel
01-14-2014, 02:08 PM
Hello Sam! Actually friend, I did not develop a new code, as I mentioned, I chose to use a software to update the tags of the MP3 files. If I use the VBA, I would have to obtain those information and put them in all rows corresponding to the tracks. With this software you only have to put the informations in the fields of a window that is displayed after match the album in the database of Amazon, Discogs or Tracktype:

11092

And update all tracks in the same time by pressing "Write Tags!" button.
You can also organize the file names according to some variables, for example, Artist & " - " & Album.