我想在以下代码中更改Y&的字体颜色。协助 如果我在命令按钮属性中更改颜色,则我将其同时应用于Y和M。我希望两者都具有独立的颜色
If checker = False Then
CommandButton1.Caption = "Y"
checker = True
Else
CommandButton1.Caption = "m"
checker = False
End If
CommandButton1.Enabled = False
答案 0 :(得分:1)
您可以使用ForeColor
属性。在网上查找是一件相当容易的事情。您也可以只在设计器中查看按钮对象的属性。
如果在If条件内,则没有区别。
CommandButton1.ForeColor = vbYellow