类模块clsJobButton的代码:
Public WithEvents cmdJob As CommandButton
Private Sub cmdJob_Click()
MsgBox "类模块"
End Sub
窗体有三个按钮cmdJob1~3,代码为:
Dim U(1 To 3) As New clsJobButton
Private Sub Form_Load()
Dim i As Long
Set U(1).cmdJob = Me.cmdJob1
Set U(2).cmdJob = Me.cmdJob2
Set U(3).cmdJob = Me.cmdjob3
End Sub
Private Sub cmdJob2_Click()