Commandbutton控件
一个Command怎么可以有俩种功能啊?原来是打开,按了后变成关闭
[解决办法]
Private Sub Command1_Click() With Command1 If .Caption = "打开" Then .Caption = "关闭" '打开代码 ... Else .Caption = "打开" '关闭代码 ... End If End WithEnd Sub
[解决办法]
'另外一个怪招,当然楼上的是正解,还可以将两个command叠放到一起:Private Sub Command1_Click()Command1.Visible = FalseCommand2.Visible = True'你的代码End SubPrivate Sub Command2_Click()Command2.Visible = FalseCommand1.Visible = True'你的代码End Sub
[解决办法]
这个还是比较简单的,方法很多
读取属性和设变量都是方法
Private commandBl As Boolean
Private Sub Command1_Click()
if commandbl = false then
msgbox “打开"
commandbl=true
else
msgbox “关闭"
commandbl=false
end if
[解决办法]