Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct Syntax for Changing Color of Cell Based on Value W Excel Discussion (Misc queries) 3 December 6th 08 10:39 PM
Syntax-Change? Peter Ostermann Excel Programming 4 January 27th 07 04:52 PM
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
Syntax for changing font color in a Shapes object Ben Excel Programming 3 October 29th 06 06:28 PM
Font.Color - syntax error ? Linda Edlund Excel Programming 2 April 14th 06 08:55 AM


All times are GMT +1. The time now is 07:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"