Set Raw Material and Visual Properties ++

I want to change material for the part by using VBA.

Is there a easy way change material like doing it in the feature tree - so the graphic, hatch is correct.


If I record a macro, I found SetMaterialPropertyName2 Method (IPartDoc)  is used.
But if I playbabck the macro the visual effect do not change, as if I change the material in the feature tree?

------

There is an example, but it is a lot of code to get all the material informations.
http://help.solidworks.com/2018/english/api/sldworksapi/Get_and_Set_Material_Visual_Properties_Example_VB.htm

SolidworksApi/macros