Results 1 to 6 of 6

Thread: Macro to apply MP3 tags changes with VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Sep 2023
    Posts
    2
    Location

    Macro to apply MP3 tags changes with VBA

    Hi! So I got my whole Music Library in a Folder (+5000 Songs) and I wanted to rearrange the tags of the mp3 files and the file name.

    So I got to this code to Read the properties of every mp3 file in a folder:

    Sub Read_MP3_Files()
    Dim FolderPath As Variant
    Dim Item As Object
    Dim oFile As Object
    Dim oFolder As Object
    Dim oShell As Object
    Dim r As Long
    Dim Rng As Range
    ' Prompt the user to select a folder
    With Application.FileDialog(msoFileDialogFolderPicker)
        .Title = "Select a Folder"
        If .Show = -1 Then
            FolderPath = .SelectedItems(1)
        Else
            Exit Sub
        End If
    End With
    Range("A1:H1") = Array("File Name", "Song Title", "Artist", "Album", "Year", "Genre", "Description", "Art Cover")
    Set Rng = Range("A2")
    Set oShell = CreateObject("Shell.Application")
    Set oFolder = oShell.Namespace(FolderPath)
    If oFolder Is Nothing Then
        MsgBox "Folder was Not Found", vbExclamation
        Exit Sub
    End If
    Set oFile = oFolder.Items
    oFile.Filter 64, "*.mp3"
    If oFile.Count = 0 Then
        MsgBox "No MP3 Files Were Found in this Folder.", vbExclamation
        Exit Sub
    End If
    For Each Item In oFile
        With oFolder
            Rng.Offset(r, 0) = .GetDetailsOf(Item, 0)
            Rng.Offset(r, 1) = .GetDetailsOf(Item, 21)
            Rng.Offset(r, 2) = .GetDetailsOf(Item, 20)
            Rng.Offset(r, 3) = .GetDetailsOf(Item, 14)
            Rng.Offset(r, 4) = .GetDetailsOf(Item, 15)
            Rng.Offset(r, 5) = .GetDetailsOf(Item, 16)
            Rng.Offset(r, 6) = .GetDetailsOf(Item, 25)
        End With
        r = r + 1
    Next Item
    End Sub
    "

    But now, I need another macro to then apply the changes that I will make on excel to those files.

    I attached the file with the vba code, a example on it of some mp3 files that i had on a test folder.

    ( The file as a column named "Art Cover" that i intend to also give me the art cover of the mp3 files, but im going step by step first ) - Open for suggestions.

    Thank you!
    Attached Files Attached Files
    Last edited by Aussiebear; 09-30-2023 at 01:07 PM. Reason: Added code tags to supplied code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •