Color Change Syntax

M

Minitman

Greetings,

I have a CommandButton on a worksheet from the Toolbars>Control
Toolbox. I need it to change colors when I click on it.

Using the macro recorder, the button shows up as a Shape. However the
recorder did not record the actual color changing that I hopped it
would. The recorder showed this:

ActiveSheet.Shapes("CommandButton1").Select

From that I tried this:

With ActiveSheet.Shapes("CommandButton1")
.Select
With .Fill
.BackColor = &HFFFF00
.ForeColor = &H0&
End With
End With

This give a type mismatch error high lighting the .BackColor line.

Anyone know how to make this work?

Any help is appreciated.

-Minitman
 
B

Bob Phillips

With ActiveSheet.OLEObjects("CommandButton1").Object

.BackColor = &HFFFF00
.ForeColor = &H0&
End With

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top