使用一个布尔型变量B,点击按钮后,根据B的值的不同,而执行不同代码 如下面所述
Dim B As BooleanPrivate Sub Command1_Click()If B = False ThenB = TrueShape1.FillColor = vbBlueElseB = FalseShape1.FillColor = vbRedEnd IfEnd Sub