What wrong of my MACRO VB.net code for setting material?

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"

        WriteProperties()

    End Sub

    Public swApp As SldWorks

SolidworksApi macros