PDA

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



Cyberdude
12-21-2006, 02:18 PM
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?

lucas
12-21-2006, 09:29 PM
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 :2p:

Kieran
12-21-2006, 09:30 PM
CyberDude,

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

tstom
12-21-2006, 10:37 PM
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... :)

Cyberdude
12-22-2006, 03:30 PM
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.

Bob Phillips
12-22-2006, 06:21 PM
And then you gotta re-learn it all again in 2007!

Brandtrock
12-22-2006, 09:20 PM
And then you gotta re-learn it all again in 2007!

Everytime I start to know the answers, MS changes the questions!! :banghead:

Bob Phillips
12-23-2006, 02:58 AM
Everytime I start to know the answers, MS changes the questions!! :banghead:

That's because MS knows best, and they know what question you SHOULD be asking :censored:

SamT
12-24-2006, 05:09 AM
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?




Sub NewName()
Application.Dialogs(xlDialogDefineName).Show
End Sub