是否有可能以编程方式在comboBox
上创建event method
?以编程方式在VBA中创建事件侦听器
表上我有一个ComboBox
,我可以通过代码得到它的名字:
Dim ole As OLEObject
For Each ole In ActiveSheet.OLEObjects
If TypeName(ole.Object) = "ComboBox" Then
' ole.Name '<<<<<<<< here
End If
Next ole
我现在如何才能创建并分配一个event method
为ole.Name
:
Private Sub myComboBox_Change()
...
End Sub
在Java中它可以使用:myComboBox.setOnChangeListener(...some code of listener interface...)
;)
请参阅“创建事件过程” - http://www.cpearson.com/excel/vbe.aspx –
您是否可以在设计时而不是运行时设置它? –
也许这个问题可能有帮助吗? http://stackoverflow.com/questions/14994235/handling-events-for-oleobject-commandbuttons-created-at-runtime – hstay