'distinguish between bodies in catia using catvba

refer to the previous question

Function CheckApplyMaterialonbody(sourcePartProduct As Product, mparameterset) As Boolean
        
    Dim oRootPart As Part
'    Dim oMainBody As Body
    Dim nam As String
    
    Set oRootPart = sourcePartProduct.ReferenceProduct.Parent.Part

    CheckApplyMaterialonbody = True
    
    no_of_publi = sourcePartProduct.ReferenceProduct.Publications.Count
    Set bodyx = oRootPart.MainBody
    nam = bodyx.InternalName
    .
    .
    .

before the last line of code the function terminates and no value is assigned to variable nam



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source