The code writes to the immediate window. If you want to write it to the document cursor position change Debug.print to Selection.Text =
If you restore the commented out items as shown below, you can list all the available metadata, which will depend on file type. See for yourself if it includes the required data. The numbers at the ends of the rows are the codes associated with each entry (as opposed to the 27 in the previous code)
Code:
Option Explicit
Sub Test()
'Based on code from
'https://stackoverflow.com/questions/54152307/how-do-i-read-the-metadata-information-from-a-closed-workbook-using-excel-vba
Dim oDetails, sName
Set oDetails = GetDetails("D:\Sound Data\Pink Floyd - Complete collection\Pink Floyd [1995] - Pulse (Live)\Pink Floyd - 23 - Comfortably Numb.mp3")
For Each sName In oDetails
Selection.TypeText sName & " = " & oDetails(sName)
Next
End Sub
Function GetDetails(sPath)
Dim sFolderName, sFileName, oShell, oFolder, oFile, oDetails, i, sName, sValue
SplitFullPath sPath, sFolderName, sFileName
Set oShell = CreateObject("Shell.Application")
Set oFolder = oShell.Namespace(sFolderName)
Set oFile = oFolder.ParseName(sFileName)
Set oDetails = CreateObject("Scripting.Dictionary")
For i = 0 To 511
sName = oFolder.GetDetailsOf(oFolder.Items, i)
sValue = oFolder.GetDetailsOf(oFile, i)
If sName <> "" And sValue <> "" Then oDetails(sName) = sValue & " - " & i & vbCr
DoEvents
Next
Set GetDetails = oDetails
End Function
Sub SplitFullPath(sPath, sFolderName, sFileName)
With CreateObject("Scripting.FileSystemObject")
If Not .FileExists(sPath) Then Exit Sub
sFolderName = .GetParentFoldername(sPath)
sFileName = .GetFileName(sPath)
End With
End Sub