Consulting

Results 1 to 9 of 9

Thread: How to change the shape of Command Button ?

  1. #1

    Question How to change the shape of Command Button ?

    Hi all,

    In Excel, generally "command button" comes with a rectangular shape. Is it possible to make it in other shape? For example, I want to change it to ARROW shape. Can anyone tell me whether is it possible?

    Thanks and Regards,
    Volabos

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    No you can't, but you can assign a Macro to shapes, including arrows, from the Drawing Menu. The user clicks on the shape to run the macro.

  3. #3
    Quote Originally Posted by volabos
    Hi all,

    In Excel, generally "command button" comes with a rectangular shape. Is it possible to make it in other shape? For example, I want to change it to ARROW shape. Can anyone tell me whether is it possible?

    Thanks and Regards,
    Volabos
    You can place what shape you want on both a spreadsheet and a form (I think you are probably talking about a form, but it ain't clear) and you can assign whatever commands you want to a shape or even a picture so placed.
    2+2=9 ... (My Arithmetic Is Mental)

  4. #4

    Solved

    Thanks mikericksonand other who has devoted their time on my problem. I have drawn an Arrow anf then assigned macro on it. It works fine. Thanks again for your suggestion.

    Regards,

  5. #5
    VBAX Regular
    Joined
    Sep 2005
    Posts
    34
    Location

    Colour?

    Hi,

    I have also set up some shapes that I want to run macros from when I click on them.

    I am trying to get a shapes to change fill colour when they are clicked on. How can I get the macro to know which shape was clicked on and then change the fill colour (say to red) of that shape whilst ignoring the other shapes.

    If possible I would like to reuse the code for each of the shapes.

    Thanks in advance.

    Chris

  6. #6
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    If you use:
    Activesheet.Shapes(Application.Caller)
    that will refer to the shape that is calling the macro. You can then assign the same macro to all shapes.
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    To fill it:
    Sub FillShape()
       Dim shp As Shape
       Set shp = ActiveSheet.Shapes(Application.Caller)
       shp.Fill.ForeColor.RGB = RGB(255, 0, 0)
       ' rest of code here
    End Sub
    Last edited by Aussiebear; 04-08-2023 at 04:22 AM. Reason: Adjusted the code tags
    Regards,
    Rory

    Microsoft MVP - Excel

  8. #8
    VBAX Regular
    Joined
    Sep 2005
    Posts
    34
    Location
    Thanks Rory - that's exactly what I'm looking for.

  9. #9
    In excel I found that option to assign macro, when I right click on a shape. however this option does not seem to be in word. Is it not possible to the same in word? If not, then can anyone suggest me some way to get "user-shaped" command button?

    Regards,

Posting Permissions

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