有这样一段代码: ‘类模块Cmds的代码 Option Explicit Public WithEvents cmd As CommandButton Private Sub cmd_Click() UserForm1.TextBox1 = cmd.Caption End Sub ‘窗体UserForm1的代码
Option Explicit Dim co As New Collection
Private Sub UserForm_Initialize() Dim i% Dim myc As Cmds For i = 1 To 5 Set myc = New Cmds Set myc.cmd = Me.Controls("CommandButton" & i) co.Add myc
Next i Set myc = Nothing End Sub 请问:红色的两段代码有什么意义?为什么去掉了就不行?
|