I have written 2 separate routines to read and update MP3 ID3 tags. I am facing an issue with the Update Tag routine. It updates all tags except for the Comment tag.
I have pasted my code below. Appreciate if someone can let me know if I am doing something wrong.
-------------------------------------------------------------------------------------------------------------------
Dim id3 As Object
Dim LastRow As Long
Dim MyFilePathName As String ' full path & file name
Dim MyFileType As String ' mp3 wma etc.
Dim MyTitle As String
Dim MyArtist As String
Dim MyAlbum As String
Dim MyYear As Variant
Dim MyGenre As String
Dim MyTrack As Variant
Dim MyComments As String
Sub Update_Tags()
Set id3 = CreateObject("CDDBControlRoxio.CddbID3Tag")
LastRow = Cells(2, 1).End(xlDown).Row
For r = 2 To LastRow
If Cells(r, 11) = "Y" Then
'Get file properties from sheet
MyFilePathName = Cells(r, 1) & "\" & Cells(r, 2) & "." & Cells(r, 3) 'Path, filename and Extension are stored in Column A, B and C respectively
MyFileType = Cells(r, 3)
MyTitle = Cells(r, 4)
MyArtist = Cells(r, 5)
MyGenre = Cells(r, 6)
MyAlbum = Cells(r, 7)
MyYear = Cells(r, 8)
MyTrack = Cells(r, 9)
MyComments = Cells(r, 10)
' Write to file
With id3
.LoadFromFile MyFilePathName, False
.Title = MyTitle
.LeadArtist = MyArtist
.Album = MyAlbum
.Year = MyYear
.Genre = MyGenre
.Comment = MyComments
If LCase(MyFileType) = "mp3" Then
.TrackPosition = MyTrack
End If
.SaveToFile MyFilePathName
End With
Range("D" & r & ":J" & r).Copy Range("L" & r & ":R" & r)
End If
Next
ThisWorkbook.Save
End Sub
I have pasted my code below. Appreciate if someone can let me know if I am doing something wrong.
-------------------------------------------------------------------------------------------------------------------
Dim id3 As Object
Dim LastRow As Long
Dim MyFilePathName As String ' full path & file name
Dim MyFileType As String ' mp3 wma etc.
Dim MyTitle As String
Dim MyArtist As String
Dim MyAlbum As String
Dim MyYear As Variant
Dim MyGenre As String
Dim MyTrack As Variant
Dim MyComments As String
Sub Update_Tags()
Set id3 = CreateObject("CDDBControlRoxio.CddbID3Tag")
LastRow = Cells(2, 1).End(xlDown).Row
For r = 2 To LastRow
If Cells(r, 11) = "Y" Then
'Get file properties from sheet
MyFilePathName = Cells(r, 1) & "\" & Cells(r, 2) & "." & Cells(r, 3) 'Path, filename and Extension are stored in Column A, B and C respectively
MyFileType = Cells(r, 3)
MyTitle = Cells(r, 4)
MyArtist = Cells(r, 5)
MyGenre = Cells(r, 6)
MyAlbum = Cells(r, 7)
MyYear = Cells(r, 8)
MyTrack = Cells(r, 9)
MyComments = Cells(r, 10)
' Write to file
With id3
.LoadFromFile MyFilePathName, False
.Title = MyTitle
.LeadArtist = MyArtist
.Album = MyAlbum
.Year = MyYear
.Genre = MyGenre
.Comment = MyComments
If LCase(MyFileType) = "mp3" Then
.TrackPosition = MyTrack
End If
.SaveToFile MyFilePathName
End With
Range("D" & r & ":J" & r).Copy Range("L" & r & ":R" & r)
End If
Next
ThisWorkbook.Save
End Sub