Try this code. Replace the name of your excel - line 2, the names of your components and write their properties in excel. If you don't want information about the main assembly, then comment out lines 8 and 9.
Sub main
Dim sPathExcel As String = "C:\Users\AndriiHumeniuk\Documents\YourExcel.xlsx"
Dim sListName As New List(Of String) From {"Assy_A=L5+M5", "Assy_B=L6+M6", "Part_B=L8+M8", _
"Part_D=L10+M10", "Part_C=L1+M1"}
Dim sWriteComp As New List(Of String)
GoExcel.DisplayAlerts = False
GoExcel.Open(sPathExcel, "Sheet1")
GoExcel.CellValue("A1") = ThisDoc.FileName(False)
GoExcel.CellValue("B1") = String.Concat("", Round((iProperties.Value("Project", "Mass") / 1000), 2))
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oOccDef As ComponentDefinition
Dim oOccDoc As Document
Dim oMass As Double
Dim i As Integer = 2
Dim sOccName, pathName, pathDisc, pathMass, pathMid As String
For Each oOcc As ComponentOccurrence In oDef.Occurrences
sOccName = oOcc.Name.Substring(0, oOcc.Name.IndexOf(":"))
If Not sWriteComp.Contains(sOccName) Then
pathName = GetFullNameAndPath(sListName, sOccName)
If String.IsNullOrEmpty(pathName) Then Continue For
pathMid = pathName.Remove(0, pathName.IndexOf("=") + 1)
pathDisc = pathMid.Substring(0, pathMid.IndexOf("+"))
pathMass = pathName.Remove(0, pathName.IndexOf("+") + 1)
sWriteComp.Add(sOccName)
oOccDef = oOcc.Definition
oOccDoc = oOccDef.Document
oMass = Round(oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Mass").Value / 1000, 3)
GoExcel.CellValue(pathDisc) = sOccName
GoExcel.CellValue(pathMass) = oMass
i += 1
End If
Next
GoExcel.Save
GoExcel.Close
End Sub
Private Function GetFullNameAndPath(sListName As List(Of String), sOccName As String) As String
For i As Integer = 1 To sListName.Count
If sListName.Item(i - 1).Contains(sOccName) Then Return sListName.Item(i - 1)
Next
Return Nothing
End Function