Macros to change background of a combobox


Posted by Geoff CE on August 03, 2001 8:42 AM

I've tried to record a macro to change the
background colour and protection of certain
cells and comboboxes (via design mode and properties).
This works fine for the ordinary cells, but not for
the Combo boxes. What am I doing wrong?

Posted by Cory on August 03, 2001 8:53 AM

Try adding this to your macro:

Sheet1.ComboBox1.BackColor = 8

this changes the backcolor to black. Use other numbers for different colors... There's a recent post that has the color codes and I'll search it out and append the address to this post later.

Cory



Posted by Ivan F Moala on August 03, 2001 8:54 AM

You need to access the Controls propeties.
Recording a macro will not do this.

Syntax is;
ComboBox1.BackColor = [long value]

where long = the colour as a long integer value
representing the colours as RGB ie. Red component
, green component , Blue component.

Easiest way to get this vlue is to change it via
the properties box ad then copy the &Long value
to your code.


HTH


Ivan