Installed Addin file opens when it shouldn't

A

Aaron

I have created a .xls file with a small macro and a toolbar to access the
macro.
I have saved the file as .xla then installed as an Addin.

When I run the macro I get the standard 'enable/disable macro' message,
however it indicates that the file the macro is in is the orginal .xls file,
not the .xla. When run, the .xls file also opens.
With a saved and installed Addin, why would this happen? Should Addin files
never show their worksheet or open in this manner?
 
G

Gord Dibben

Add-ins will not generate the macros warning since it is assumed they are safe
because you chose to install them.

Your warning is probably coming from the workbook.xls that is also opening.

The Toolbar button macro assignments probably still point to the original
workbook.xls

Clean out the references to the original.

With the Add-in installed.............

Tools>Customize and right-click on one of the toolbar buttons and "assign macro"

You will see workbook.xls!macroname

Remove any reference to the original workbook.and leave just the macro name.

Each button will have to be re-assigned.

Play with it until you get it.


Gord Dibben MS Excel MVP
 
A

Aaron

Thanks Gord,

I can amend the button macro assigment after installing the Add-in, however
what I'm needing to do is create an Add-in with it's macros assigned to
custom toolbar buttons and distribute to other users. I'm hoping that they
should be able to just install the Add-in and not have to modify the button's
macro assignment after the installation.
I have code in the Add-in workbook that makes the custom toolbar visible
when installed and not visible when removed. The problem seems to be that
after creating the application as an .xls file then saving as an .xla file,
the button macro assignments don't follow suit and still point to the
original .xls file.
Is there a way to assign the button macros during design as an .xls file so
that they reference internally to the installed .xla file so the buttons
don't have to be modified after the Add-in is installed?
 
G

Gord Dibben

Toolbar and menu changes are saved in your Excelxx.xlb file which you would have
to copy to other users' computers and overwrite theirs.

NOT a good idea and should not be considered.

You can attach a Toolbar to a workbook by Tools>Customize>Toolbars>Attach.

You would have to do this in your workbook.xls before you save as an add-in.

By far the best and most stable method is to create the Toolbar when your add-in
opens and delete the Toolbar when it closes. This way, there is never any doubt
to which path the macros need.

They always point to the add-in only.

For code see Debra Dalgleish's site on creating Toolbars "on the fly"
for an add-in

http://www.contextures.on.ca/xlToolbar02.html


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top