ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Color Change Syntax (https://www.excelbanter.com/excel-programming/411300-color-change-syntax.html)

Minitman

Color Change Syntax
 
Greetings,

I have a CommandButton on a worksheet from the ToolbarsControl
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

Bob Phillips

Color Change Syntax
 


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)

"Minitman" wrote in message
...
Greetings,

I have a CommandButton on a worksheet from the ToolbarsControl
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




Minitman

Color Change Syntax
 
Hey Bob,

That works very well.
Thanks.

-Minitman

On Wed, 21 May 2008 16:14:04 +0100, "Bob Phillips"
wrote:

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)

"Minitman" wrote in message
.. .
Greetings,

I have a CommandButton on a worksheet from the ToolbarsControl
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





All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com