How to permanently add a custom button?

S

slingsh0t

I want to change my $ icon to use *my* preference of currency format
rather than "accounting". I created a new button and assigned a bit of
code to it, and it worked great- until I closed that workbook and
opened a new one. The icon is still there, but the code is not, so an
error appears.

How do I permanently add an icon? Or, how do I change the commands
associated with an existing icon?

Thanks for any assistance- I've been fussing over this for way too long!
 
G

Gord Dibben

The code is in the workbook you closed and that workbook should open when you
click on your button.

Does it not?

Can Excel find it?

What is the error message?

To have a macro available for all workbooks, store it in your Personal.xls in
XLSTART folder or into an add-in which you load through Tools>Add-ins.

The Icon you added is stored with the Toolbars set-up in your *.XLB file.

Apparently that saves properly since the Icon is showing up.


Gord Dibben Excel MVP
 
S

slingsh0t

Gord- Thanks for your response. I'd like to make the code/button
available globally without opening a secondary file. I'm using Excel
2003; I searched for but could not locate a file called Personal.xls.
Any recommendations?

Thanks again for your help!
 
G

Gord Dibben

Personal.xls is created the first time you record a Macro using Macro
Recorder.

Tools>Macro>Record New Macro. A dialog box will come up asking you name the
macro and where to place it. Pick Personal Macro Workbook from the dropdown.
Copy and paste a couple of cells then Stop Recording.

You now have a Personal.xls in your Office\XLSTART folder. You can go to
Visual Basic Editor(Alt+F11) to view the macro you just recorded in a Module.

You can add more macros by recording or by typing/copying them into the
Module.

You can do a File>Save from there or better yet hit ALT + Q to return to the
Excel window.

Then with Personal.xls active, hit Window>Hide.

When you close Excel you will be asked if you want to save Personal.xls. Yes!

It will open hidden next time you start Excel.

NOTE: when assigning macros to buttons or menu items you will have to precede
the macro name with Personal.xls.

i.e. Personal.xls!macroname

An alternative to Personal.xls is to create an add-in(*.xla) with your macros
in it and load it through Tools>Add-ins.

The benefit of this is that you don't have to precede the macro name with the
filename.

A disadvantage is that you will not see the macros in the Tools>Macro>Macros
dialog.


Gord
 
Top