ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to permanently add a custom button? (https://www.excelbanter.com/excel-discussion-misc-queries/17695-how-permanently-add-custom-button.html)

[email protected]

How to permanently add a custom button?
 
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!


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 ToolsAdd-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

On 15 Mar 2005 07:44:54 -0800, wrote:

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!



[email protected]

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!


Gord Dibben

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

ToolsMacroRecord 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 FileSave from there or better yet hit ALT + Q to return to the
Excel window.

Then with Personal.xls active, hit WindowHide.

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 ToolsAdd-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 ToolsMacroMacros
dialog.


Gord

On 16 Mar 2005 04:00:52 -0800, wrote:

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!



[email protected]

Thanks for your help! Works like a charm.


Gord Dibben

Good to hear and thanks for the feedback.


Gord

On 17 Mar 2005 06:40:01 -0800, wrote:

Thanks for your help! Works like a charm.




All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com