Consulting

Results 1 to 9 of 9

Thread: Solved: How to Assign ?Define Name? to a Button on a Toolbar

  1. #1

    Solved: How to Assign ?Define Name? to a Button on a Toolbar

    I?m still trying to assign macros to buttons on my toolbar, but not succeeding. In the past I had no difficulty, but now Excel just ignores my request.

    Specifically, I want a button to call up the ?Define Name? dialog box. I cannot find the ?Define Name? command (actually it?s ?Name ? Define?) anywhere in the list of commands under customization, so I can?t just drag it to a button. As an aside, does anyone know where that command is located in the customization lists?

    Next, I created a short macro to invoke the ?Define Name? dialog box, but I can?t assign the macro to a new or old button.
    On the old button, it leaves that macro currently assigned just as it is.
    On a new button, when I click on it, I get the ?Assign a Macro? dialog box, just as if I hadn?t previous assigned a macro to it.

    I created a new toolbar with a new button, and got the same results ? ignores my attempt to assign a macro. No error messages. I would think that if the current toolbar is corrupted some how, then creating a new toolbar would work ? it doesn?t.

    Any suggestions?

  2. #2
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I seem to remember having a similar problem some time ago....I think it had to do with the Excel.xlb file.

    You could also go to help in excel and select about. Then look at the bottom for the button that reads: Disabled Items. See if anything is listed there.

    These kind of problems are what has caused me to shy away from button customization in this manner. You will also run into portability problems. I use an addin that provides the menu's, buttons, macro's and it's portable and easy to back up. Just my
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Regular
    Joined
    Sep 2004
    Location
    Perth, Western Australia
    Posts
    20
    Location
    CyberDude,

    Why not use the download at http://www.decisionmodels.com/downloads.htm.
    Kieran

  4. #4
    Agree with Lucas. All of my customizations are done on the fly by way of code. However, if code is not an option, here is how you do it.

    http://home.fuse.net/tstom/InsertNameDefine.swf.html

    The Shockwave Flash movie is 1.14 MB.
    If you have a problem watching the movie, let me know and I'll post a step by step...

  5. #5
    Thanks to all of you who replied with suggestions. I haven't written toolbar creation logic for a long time, but it looks like I'm going to have to re-learn how to do it, and create my own as you have suggested.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    And then you gotta re-learn it all again in 2007!

  7. #7
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Quote Originally Posted by xld
    And then you gotta re-learn it all again in 2007!
    Everytime I start to know the answers, MS changes the questions!!
    Brandtrock




  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Brandtrock
    Everytime I start to know the answers, MS changes the questions!!
    That's because MS knows best, and they know what question you SHOULD be asking

  9. #9
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Quote Originally Posted by Cyberdude
    I’m still trying to assign macros to buttons on my toolbar, but not succeeding. In the past I had no difficulty, but now Excel just ignores my request.

    Specifically, I want a button to call up the “Define Name” dialog box. I cannot find the “Define Name” command (actually it’s “Name – Define”) anywhere in the list of commands under customization, so I can’t just drag it to a button. As an aside, does anyone know where that command is located in the customization lists?

    Next, I created a short macro to invoke the “Define Name” dialog box, but I can’t assign the macro to a new or old button.
    On the old button, it leaves that macro currently assigned just as it is.
    On a new button, when I click on it, I get the “Assign a Macro” dialog box, just as if I hadn’t previous assigned a macro to it.

    I created a new toolbar with a new button, and got the same results … ignores my attempt to assign a macro. No error messages. I would think that if the current toolbar is corrupted some how, then creating a new toolbar would work … it doesn’t.

    Any suggestions?


    [VBA]
    Sub NewName()
    Application.Dialogs(xlDialogDefineName).Show
    End Sub
    [/VBA]

Posting Permissions

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