|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Access2010中,
有一个类模块clsJobButton,全部代码如下:
Option Compare Binary
Option Explicit
Public WithEvents cmdJob As CommandButton
Private Sub cmdJob_Click()
MsgBox "A"
End Sub
'------------------------------------------------
窗体中有两个CommandButton控件:cmdJob1和cmdJob2
窗体中的代码:
Option Compare Binary
Option Explicit
Dim oCo As New Collection
Private Sub Form_Load()
Dim i As Long, cmdButton As clsJobButton
For i = 1 To 2
Set cmdButton = New clsJobButton
Set cmdButton.cmdJob = Me.Controls("cmdJob" & i)
oCo.Add cmdButton
Next
End Sub
运行Form,单击按钮,结果根本无法调用到类模块中的Click过程,为什么会不起作用呢?
我的调用方法错了吗?求指教,先行谢过!
|
|