Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
command button color
is there a way to refer to the color of the button as simply "red..." rather
than: &H8000000F& (it's a bit cryptic) as always, thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
command button color
If in VBA, use the pre-defined color constants or, if not available, define
your own. Private Sub CommandButton1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If CommandButton1.BackColor < vbRed Then CommandButton1.BackColor = vbRed CommandButton1.ForeColor = vbBlack Else CommandButton1.BackColor = vbBlack CommandButton1.ForeColor = vbRed End If End Sub Private Sub CommandButton1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Const clrRed = &HFF& Const clrBlack = &H80000012 If CommandButton1.BackColor < clrRed Then CommandButton1.BackColor = clrRed CommandButton1.ForeColor = clrBlack Else CommandButton1.BackColor = clrBlack CommandButton1.ForeColor = clrRed End If End Sub You can define constants in a procedure, or in the declaration section (at the top) of a module, either private or public, depending on the scope (how widely available among your code) that you need. "mark kubicki" wrote in message ... is there a way to refer to the color of the button as simply "red..." rather than: &H8000000F& (it's a bit cryptic) as always, thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change the face color of an Excel command button | Excel Discussion (Misc queries) | |||
Change color of command button | Excel Discussion (Misc queries) | |||
color fill button is not adding color to my spread sheet | Excel Worksheet Functions | |||
Command Button vs Control Button | Excel Programming | |||
Command Button vs Form Button | Excel Programming |