AnsweredAssumed Answered

What wrong of my MACRO code for setting material?

Question asked by Marco Wu on Mar 30, 2017
Latest reply on Mar 30, 2017 by Amen Allah Jlili

My code stops at the red line. Please help





    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ALUM_BUTTON.Click



        Dim myModel As ModelDoc2

        Dim myPart As PartDoc



        myModel = swApp.ActiveDoc

        myPart = myModel



        myPart.SetMaterialPropertyName2("default", "solidworks material", "6061-T6(SS)")



        ReDim Preserve PropName(20)

        ReDim Preserve PropVal(20)

        PropName(0) = "Name1"

        PropName(1) = "Name2"

        PropVal(0) = "Val1"

        PropVal(1) = "Val2"




    End Sub

    Public swApp As SldWorks