Using Excel VBA to update MP3 properties: id3.LoadFromFile gives Run-time error "The remote procedure call failed"

Brahmadas

New Member
Joined
Oct 6, 2020
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
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:
--------------------------->
VBA_Error.jpg
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I found 1 difference in the file properties: in the MP3's where there's no problem with VBA the Bit rate is 64 kbps, for the MP3's where the VBA errors out Bit rate is 128 kbps. Any thoughts on how Excel VBA can handle them?
 
Upvote 0

Forum statistics

Threads
1,213,513
Messages
6,114,072
Members
448,546
Latest member
KH Consulting

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top