1, 类 动 态 数 组 控 件 ‘2007VBA 技巧 ‘快盘\My tb\更新\类\类动态数组控件.x lsm ‘2013-6-16 类模块代码: Pu blic WithEv ents frm As MSForms.UserForm Pu blic WithEv ents my Tex t As MSForms.Tex tBox Pu blic Index As Integer Priv ate Su b my Tex t_Change() Index = Mid(my Tex t.Name, 8) If frm.Controls("Tex tbox " & Index ) <> "" Then frm.Label1.Caption = "控件事件:Change" & v bCrLf & _ "控件名称:" & frm.Controls("Tex tbox " & Index ).Name & v bCrLf & _ "Tex t 属性:" & frm.Controls("Tex tbox " & Index ).Tex t End If End Su b Priv ate Su b my Tex t_DblClick(By Val Cancel As MSForms.Retu rnBoolean) Index = Mid(my Tex t.Name, 8) If frm.Controls("Tex tbox " & Index ) <> "" Then frm.Label1.Caption = "控件事件:DblClick" & v bCrLf & _ "控件名称:" & frm.Controls("Tex tbox " & Index ).Name & v bCrLf & _ "Cancel 属性:" & Cancel End If End Su b Key Up 事件与Change 事件重迭,二者取其一 Priv ate Su b my Tex t_Key Up(By Val Key Code As MSForms.Retu rnInteger, By Val Shift As Integer) Index = Mid(my Tex t.Name, 8) If frm.Controls("Tex tbox " & Index ) <> "" Then frm.Label1.Caption = "控件事件:Key Up" & v bCrLf & _ "控件名称:" & frm.Controls("Tex tbox " & Index ).Name & v bCrLf & _ "按键值:&H" & Hex $(Key Code) End If End Su b Priv ate Su b my Tex t_Mou seMov e(By Val Bu tton As Integer, By Val Shift As Integer, By Val X As Single, By Val Y As Single) Select Case Index Case 3 Userform2.Label2.Caption = "3" Case 8 Userform2.Label2.Caption = "8" Case 4 Userform2.Label2.Caption = "4" Case 9 Userform2.Label2.Caption = "9" Case Else Userform2.Label2.Caption = " " End Select End Sub 模块1 代码: Public a(1 To 14) As myText Sub formshow() Userform2.Show End Sub 窗体代码: Private S...