+ Reply to Thread
Results 1 to 4 of 4

Changing Button BackColor

Hybrid View

  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Changing Button BackColor

    Hi all,

    I have this code:
    With ActiveSheet.Shapes("CommandButton12")
        .BackColor = &H800000
    End With
    which I thought would change the background colour/color of the button but I receive the error: Object does not support this method. Any ideas on how I can make this work?

    As always, I appreciate your time.
    Last edited by Mordred; 01-21-2011 at 07:06 PM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Changing Button BackColor

    Hello Mordred,

    If this control is on the worksheet and from the Control ToolBox the code would be...
      ActiveSheet.OLEObjects("CommandButton12").Object.BackColor = &H80000000
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Changing Button BackColor

    Thanks Leith Ross, I was at this site:
    http://www.mrexcel.com/forum/showthread.php?t=341450and it, among a couple of other sites said it was not possible to program the background color of buttons. It suggested to create rectangles, which I was going to do but this will save me a lot of time. Thanks so much.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Changing Button BackColor

    You can't for buttons from the Forms toolbar.

    ActiveX controls are more flexible at the expense of breaking occasionally.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1