I am Setting Track Position for a group of MP3's. For 1 group of MP3's this Sub works fine; yet for a different group of MP3's. When run on the 2nd group of MP3's this Sub works fine until the 2nd iteration of the Do While Loop and errors out on the line
.LoadFromFile MyFileFullName, False
with error message:
Run-time error '-2147023170 (800706be)'
Automation error
The remote procedure call failed
---------------------------------
As far as I can tell the MP3 file properties are the same in both groups of .MP3 files. Have you ever seen this before in Excel VBA? How to fix? Below is the simple code for the Sub:
'***************************************************************************************************************************
Sub SetMP3FileProperties()
Dim id3 As Object
Dim MyFileFullName As String ' full path & file name
Dim MyNumber As Integer
Set id3 = CreateObject("CDDBControlRoxio.CddbID3Tag")
sDir = "C:\Users\BradPC\Music\AbbeyRoad\"
sFileName = Dir$(sDir & "\*.mp3")
MyNumber = 1 'Mid(sFileName, 1, 2)
Do While sFileName > ""
MyFileFullName = sDir & "\" & sFileName
' Write to file
With id3
.LoadFromFile MyFileFullName, False '<--here's where it errors on 2nd iteration of the Loop
.TrackPosition = MyNumber
.SaveToFile MyFileFullName
End With
MyNumber = MyNumber + 1
sFileName = Dir$
Loop
ThisWorkbook.Save
End Sub
'***************************************************************************************************************************
Below is the screenshot:
--------------------------->
.LoadFromFile MyFileFullName, False
with error message:
Run-time error '-2147023170 (800706be)'
Automation error
The remote procedure call failed
---------------------------------
As far as I can tell the MP3 file properties are the same in both groups of .MP3 files. Have you ever seen this before in Excel VBA? How to fix? Below is the simple code for the Sub:
'***************************************************************************************************************************
Sub SetMP3FileProperties()
Dim id3 As Object
Dim MyFileFullName As String ' full path & file name
Dim MyNumber As Integer
Set id3 = CreateObject("CDDBControlRoxio.CddbID3Tag")
sDir = "C:\Users\BradPC\Music\AbbeyRoad\"
sFileName = Dir$(sDir & "\*.mp3")
MyNumber = 1 'Mid(sFileName, 1, 2)
Do While sFileName > ""
MyFileFullName = sDir & "\" & sFileName
' Write to file
With id3
.LoadFromFile MyFileFullName, False '<--here's where it errors on 2nd iteration of the Loop
.TrackPosition = MyNumber
.SaveToFile MyFileFullName
End With
MyNumber = MyNumber + 1
sFileName = Dir$
Loop
ThisWorkbook.Save
End Sub
'***************************************************************************************************************************
Below is the screenshot:
--------------------------->