|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
像要做一个窗体内多个可编辑的MSFlexGrid控件
用文本框移动到要编辑位置
'form 窗体代码
Dim co As New Collection
Private Sub Form_Initialize()
Dim i%, obj
Dim myc As Cmds
For Each obj In Me.Controls
If obj.Name Like "MSFlexGrid*" Then
Set myc = New Cmds
Set myc.cmd = obj
co.Add myc
End If
Next
End Sub
'类模块代码
Public WithEvents cmd As MSFlexGrid
Public WithEvents txt As Textbox
'以下这段鼠标按下事件可以响应
Private Sub cmd_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
MsgBox cmd.Name
End Sub
'这段文本框事件无法触发
Private Sub txt_Change()
MsgBox cmd.Name
End Sub
如何是txt的事件也能响应? 初学类模块. 代码也是七拼八凑的..请问改如何修改 |
|