View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
AJ Master AJ Master is offline
external usenet poster
 
Posts: 29
Default Checkbox Background Color

On Jan 9, 3:40 pm, "Peter T" <peter_t@discussions wrote:
"AJ Master" wrote in message

...



On Jan 9, 2:36 pm, "Peter T" <peter_t@discussions wrote:
Unfortunately, although you can apply Transparent it does not persit when
the control is clicked, it will then show whatever colour is set for its
backcolor property. I don't know if this has been fixed in XL2007


Regards,
Peter T


<snip

Peter,


Is there anyone to code an event change that would update the
backcolor? Is there a way to add the custom color I'm using to the
color palette excel shows me?


Thanks again...AJ


Dim ole As OLEObject

Set ole = ActiveSheet.OLEObjects("Checkbox1")
ole.Object.BackColor = RGB(150, 200, 250)

' customize a palette color
ActiveWorkbook.Colors(7) = RGB(250, 200, 150)
' 7 is under red in a default palette
' apply a palette colour
ole.Object.BackColor = ActiveWorkbook.Colors(7)

You mention 'event' so maybe something like this (code in the sheet module
containng the checkbox)

Private Sub CheckBox1_Click()
With CheckBox1
If .Value Then
.BackColor = RGB(255, 255, 255)
Else
.BackColor = RGB(150, 230, 150)
End If
End With
End Sub

Regards,
Peter T


Peter,

Thanks again. I set the property on all checkboxes when the workbook
opens.

AJ