Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Star Lounger
    Join Date
    Feb 2003
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Colored buttons?

    Whenever I create a button (e.g. to assign a macro), it is always grey in color. Is it possible to have colored buttons (I know how to color the fonts but not the button itself). Thanks in advance.[img]/w3timages/icons/scream.gif[/img]

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    You are restricted in the colours you can apply to Command Buttons, Dialog Boxes etc. These colours are tied in to the Desktop Scheme you set up under Windows (Control Panel, Display, Appearance).

    However you can add colour to your macros by using Drawing Objects. You can assign macros to these objects, and can use your own choice of colour scheme (and shape, shadow, 3D effects etc).

    regards,

    Andrew C

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    What version of Excel are you using, where is the button (on the sheet or in a user form), and how did you create the button (the control tool box?)?

    On Excel 97, if I create a button on a spread sheet using the Control Tool box (from View/Toolbars), I can right click on the button and select Properties. In the properties window, I can click on BackColor. I then get a window for selecting the color. I can click on the Pallet tab at the top of this window and I have a full selection of colors for the button.
    Legare Coleman

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Legare

    I use both Excel 97 & 2000, but you are right - I never noticed the palette tab. I just select (or rather don't select) from the system tab. I prefer to stick to system colours, but that's no reason for others to do the same.

    Is the palette restricted or do you have access to all colours?. ( I can see 48, including shades of grey). What happens if the sheet is displayed on a PC set to display only 16 colours (unlikely) ?

    Thanks for that enlightennment,


    [img]/S/smash.gif[/img]
    Andrew

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    I don't really know. However, if the PC were set up to only be able to display 16 colors, that is all that you would be able to see in the pallet, no matter how many it tried to display. If I had to guess, I would guess that it would only try to display 16.
    Legare Coleman

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Yeah, generally, it selects the color closest to the original when displayed in 16 colors.

    Drk.
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  7. #7
    Star Lounger
    Join Date
    Feb 2003
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    I have Excel 2000/Win98SE. I usually create buttons by opening the forms toolbar and dragging a button to a worksheet. I tried the method that Legare suggested (i.e. by using the Control Toolbox) and by right clicking & selecting Properties, I do indeed see a Back Color option and the palette. So that clarifies that point! But raises another: Is there any difference in the buttons created via a Forms toolbar versus a Control Toolbox toolbar? One glaring difference I notice is that when created from the Control Toolbox, there is no option to assign a macro (or am I missing something?) Since I create buttons primarily to assign macros, it would seem to me that I can only use the Forms toolbar for that, and that leaves me with the situation that I cannot assign colors to that button! Any thoughts?

  8. #8
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Well, I don't know what good a button would be if you could not run code from it.

    Create a button from the Control ToolBox. Right click on the button, and right under properties is "View Code." Select that, and you will be taken to a place where you can put your VBA code. If you already have the code in a standard VBA module, you can just call it from the button click event.
    Legare Coleman

  9. #9
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    If you do as Legare suggests re the Code, you can select properties as well and apply your colour, system or palette.

    I have a suspicion that if you use either of these colouring methods it could appear very differently an another PC if the palette or system colours are set differently.

    Regards,

    Andrew C

  10. #10
    Star Lounger
    Join Date
    Feb 2003
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    I am sorry if I seem dense, but I have just started exploring Excel's many features. I understand what a macro is, but don't quite understand what a VBA module is, nor do I know how to "call it from the button click event".
    So if I have an existing macro, I first open it and copy its contents to the clipboard; then I create a button from the Control Toolbox -> right click -> open View Code, and then copy the contents of the clipboard into this window and this will assign the macro code to this button - right? Hmm, why didn't Microsoft let one easily assign a macro instead of going about it in this roundabout way (that is, for buttons created with the Control Toolbox; the Forms toolbar buttons let you easily assign macros)? Or is there another, simpler way - for novices like me! Thanks for your patience.

  11. #11
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Have you considered adding a button to one of your toolbars to run the macro ?

    That is probably Microsoft's "easy" way of doing it.

    If you goto Tools|Customize| and select the Commands Tab, then scroll down through the categories until you find macros, drag the custom button a (yellow smiley) to a toolbar, and if you want change it click modify selection.

    Then when you click on your new button for the first time it present you with a list of macros from which you can select then one you want associated with that button.


    AC

  12. #12
    Star Lounger
    Join Date
    Feb 2003
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Andrew, I see what you mean (BTW, Modify Selection remains greyed out on selecting the Custom button Tools|Customize|Commands|Macros on my system - Win98SE/Excel2000). And yes, after placing this on a toolbar and clicking on it for the 1st time, it asks for a macro. But once you do that, I see no way of changing it. Also, I like buttons on the sheet, not on the toolbar. And if they all looked the same (note:Modify selection doesn't work), then it would be hard to figure out which macro was assigned to which! But your suggestion was good - and again I learnt something new!

  13. #13
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Many people use VBA module/procedure and macro interchangeably. However, for those of us who remember older versions of Excel where macros were created on a macro spreadsheet and used a very different language than VBA, there is a big difference. When I hear macro, I think of the old Excel Macro sheets. So, when I am referring to VBA, I try to refer to it as a VBA procedure (ie. Subroutine or Function).

    Yes, you can copy your "macro" code from a VBA procedure and just paste it into the button click event procedure. However, I usually prefer to put the "macro" code in a standard VBA module (what you get when you press Alt/F11 from a spreadsheet window), and call it from the click event procedure. If the "macro" in the standard module is named DoWhatIWant, then the click event procedure would look like this:

    <pre>Private Sub CommandButton1_Click()
    Call DoWhatIWant()
    End Sub
    </pre>


    By doing this, I can then use the code from more than one button if I need to.
    Legare Coleman

  14. #14
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Just for the record, you must place the button on a toolbar in order to modify it. Just drag it to a toolbar and the modify selection should be available. You then get a selection of buttons to choose from, or if you like you can design your own.

    It is possible that after dragging the button to the toolbar it became unselected, in which case just click on it and all should be ok.

    You can assign a macro to the button by right clicking on it, selecting customize, and when the dialog box opens right click again on the toolbar button and you should have an option to (re)assign a macro.

    Hope this helps,

    Andrew

  15. #15
    Star Lounger
    Join Date
    Feb 2003
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Colored buttons?

    Andrew, you are right - everything works just like you said.

Page 1 of 2 12 LastLast

Posting Permissions

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