+ Reply to Thread
Results 1 to 26 of 26

AutoCreate Command Buttons-Coloring

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    AutoCreate Command Buttons-Coloring

    I have a macro that creates command buttons on my sheet, and assigns the pertinent Macros to those command buttons. I can adjust the text to the color/style I want, but I can't figure out how to change the background colors. Can someone help? My code is shown below (BTW, after either selection I'll want to remove the buttons ("KillButts")-if someone can clue me on how to do that I'd appreciate that as well).:
    Please Login or Register  to view this content.
    Last edited by jomili; 07-25-2011 at 12:16 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: AutoCreate Command Buttons-Coloring

    This should work:
    Please Login or Register  to view this content.
    EDIT: in light of romperstomper's post below, this will only work for an autoshape button, so probably no use for you.
    Last edited by StephenR; 07-22-2011 at 10:09 AM.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    You cannot change the background colour of Forms buttons.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    You cannot change the background colour of Forms buttons.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    Stephen,
    It didn't work. I've posted an example so you can see how far I've gotten.

    Romper,
    If I can't do it this way, can you show me an alternate?
    Attached Files Attached Files

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    You would have to either use ActiveX buttons instead, or use Shapes instead of buttons. I'd avoid ActiveX unless you really, really need the background colours.

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: AutoCreate Command Buttons-Coloring

    See my edit, i.e. perhaps you could use an autoshape?

  8. #8
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    My desire is just to make these command buttons stand out. They'll be living in a sheet with a lot of distracting colors. But maybe I can do it by coloring all of the background behind these a neon green; that would make them stand out, wouldn't it?

    If I can't figure another solution I'll be back, otherwise I'll close this post in a little bit.

    Thanks, Stephen and Romper, for all your help.

    John

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    Perhaps instead of adding colour to the buttons, you need to be removing colour from the sheet?

  10. #10
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    And that's certainly a viable option. Thanks for that.

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    As a general rule, I find that the more colour there is in a worksheet, the harder it is to use, particularly for any length of time.
    You might also want to consider using a menu system (i.e. toolbars or Ribbon) rather than buttons on a sheet.

  12. #12
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    These buttons are for a one time use, either to continue with the automation already started, or finish the process manually. I started with a menu system, but my users found it too confusing (having to drift off the page, upwards to a menu that only had two options), so I'm hoping two "In Your Face" buttons will do the trick. I've included a sample of how it's going to look when all is said and done.
    Attached Files Attached Files

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    If you wanted, you could always put two red rectangles over the top of the buttons, then right-click, order-send to back so they go behind the buttons.

  14. #14
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    I'm not sure I know what you mean. Are you talking about coloring the cells above the command buttons?

  15. #15
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: AutoCreate Command Buttons-Coloring

    I know it would mean re-writing some code, but why not use shapes. Lots of choice of styles - you can have bevelled buttons, oval buttons, triangular buttons. You can go mad.

  16. #16
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    No, I mean like this.
    Attached Files Attached Files

  17. #17
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    I'm not familiar with shapes, so might be biting off more than I can chew right now.

  18. #18
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    Romper,

    I like what you did, but don't know how to do it. Please educate me.

  19. #19
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    I added a rectangle from the Drawing toolbar positioned over the button, filled it Red, then right-click it, Order - Send to Back. You can then group them with the buttons too if you wish. Or use a lovely shape as in the attached, to which you can assign a macro.
    Attached Files Attached Files

  20. #20
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: AutoCreate Command Buttons-Coloring

    Ha ha, as I said, you can go mad.

  21. #21
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: AutoCreate Command Buttons-Coloring

    And you can add pictures too...
    Attached Files Attached Files

  22. #22
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: AutoCreate Command Buttons-Coloring

    See the attachment.
    You can toggle the visibility of both buttons doubleclicking in cell F1.
    You can control the visibility also using the user's input. No need to produce or delete any button.
    Attached Files Attached Files



  23. #23
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    Okay, apparently I'm going to have to start looking into Shapes. Looks like there's some good options there.

  24. #24
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    SNB,
    I tried yours, but double-clicking in F1 didn't produce a result. I also tried putting a value in F1, nothing out of the ordinary happened, both buttons were still visible.

  25. #25
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: AutoCreate Command Buttons-Coloring

    It's helpful to enable macros....
    You didn't by accident application.enableevents=false ?
    If so : application.enableevents=true.

  26. #26
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: AutoCreate Command Buttons-Coloring

    SNB, No, I didn't disable my macros, but Excel has crashed on me twice today, so that may explain the problem. I just tried your spreadsheet again, and it worked like magic this time. Cool trick! I don't think I'll use it for this application, but I'll file it away for future use.

    Thanks,
    John

+ 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