动态生成多个VBE按钮控件并操作它们的属性(2)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-22 14:55 点击:次
(objOLEObject.Object, Forms.CommandButton)
objCommandButtonControls.Init()
Next i
End Sub
End Class
Public Class CommandButtonControls
Public WithEvents objCommandButton As Forms.CommandButton
Public Name As String
Public Caption As String
Public Sub New(ByVal Name As String, ByVal Caption As String)
Me.Name = Name
Me.Caption = Caption
End Sub
Public Sub Init()
objCommandButton.Caption = Caption
End Sub
Private Sub objCommandButton_Click() Handles objCommandButton.DblClick
MsgBox(Name & Chr(13) & Caption)
If Name.Equals("btn3") Then
objCommandButton.Font.Bold = True
End If
End Sub
End Class
这似乎是唯一行得通的方法了,因为在Worksheet中我们是没办法操作控件属性的。
摘自 TX_OfficeDev的专栏
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>