Commandbutton控件,该如何处理

Commandbutton控件
一个Command怎么可以有俩种功能啊?原来是打开,按了后变成关闭

------解决方案--------------------
VB code
Private Sub Command1_Click()
    With Command1
         If .Caption = "打开" Then
            .Caption = "关闭"
             '打开代码 ...
        Else
            .Caption = "打开"
            '关闭代码 ...
        End If
     End With
End Sub

------解决方案--------------------
VB code
'另外一个怪招,当然楼上的是正解,还可以将两个command叠放到一起:

Private Sub Command1_Click()
Command1.Visible = False
Command2.Visible = True
'你的代码
End Sub

Private Sub Command2_Click()
Command2.Visible = False
Command1.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
------解决方案--------------------
探讨
Private Sub Command5_Click()
If Command5.Caption = "打开端口" Then
Text13.Text = Now & "成功打开端口"
Command5.Caption = "关闭端口"
ElseIf Command5.Caption = "关闭端口" Then
Text13.Text = Now & "成功关闭端口"
C……