Managing Add-Ins

T

thwya

Thanks in advance for any help or ideas.....

I have two add-ins that I use to query external data sources. I can't
have both loaded in Excel at the same time because they share the menu
bar name and I can't change either of the names.

Half of the time I want to have one add-in loaded in Excel, the rest of
the time I want the other one loaded.

My goal is to create an add-in I can send to users that allows them to
click a button on a custom toolbar and switch the loaded add-in to the
one they want.

I used the following code as an example:
' Remove DataSource1 add-in
AddIns("DataSource1 Server DLL").Installed = False
' Load DataSource2 add-in
AddIns("DataSource2 Server DLL").Installed = True
(and vice versa).

The problem is that when I use the toolbar to load and unload the
add-ins I get an error when I try to use the menubar of a loaded
add-in.

For example:
MANAGE_ADDIN.XLA creates the custom toolbar with the buttons that loads
and unloads add-ins.
DATASOURCE_ADDIN1 is one of the add-ins that I use to query external
data.

I can unload and load add-ins easily with this XLA file.

If I select an item on the menubar of the add-in I just loaded it gives
me the following error:
The macro "MANAGE_ADDIN.XLA'!do_something" cannot be found."

The do_something macro is stored in DATASOURCE_ADDIN1 and not
MANAGE_ADDIN.

Is there a way to tell excel to look in the correct add-in without
changing the menu of the DATASOURCE_ADDIN itself?

Thanks.
 
J

Jim Rech

Typically add-ins create their own menus when they open and delete them went
they close. It doesn't sound like that's what you're doing because I don't
think you'd have this problem if they did.

Since you say that one add-in is always open then I suppose you could not
have the add-in remove the menu when it closes and then have the opening
add-in assign its macros to the existing menuitems using the OnAction
property. Each add-in should check whether the menu already exists (since
it wouldn't on a new system) and create it if necessary.

So your switcher add-in would do little more than close one add-in and open
the other and let each add-in handle assigning its macros to the menuitems.

--
Jim
| Thanks in advance for any help or ideas.....
|
| I have two add-ins that I use to query external data sources. I can't
| have both loaded in Excel at the same time because they share the menu
| bar name and I can't change either of the names.
|
| Half of the time I want to have one add-in loaded in Excel, the rest of
| the time I want the other one loaded.
|
| My goal is to create an add-in I can send to users that allows them to
| click a button on a custom toolbar and switch the loaded add-in to the
| one they want.
|
| I used the following code as an example:
| ' Remove DataSource1 add-in
| AddIns("DataSource1 Server DLL").Installed = False
| ' Load DataSource2 add-in
| AddIns("DataSource2 Server DLL").Installed = True
| (and vice versa).
|
| The problem is that when I use the toolbar to load and unload the
| add-ins I get an error when I try to use the menubar of a loaded
| add-in.
|
| For example:
| MANAGE_ADDIN.XLA creates the custom toolbar with the buttons that loads
| and unloads add-ins.
| DATASOURCE_ADDIN1 is one of the add-ins that I use to query external
| data.
|
| I can unload and load add-ins easily with this XLA file.
|
| If I select an item on the menubar of the add-in I just loaded it gives
| me the following error:
| The macro "MANAGE_ADDIN.XLA'!do_something" cannot be found."
|
| The do_something macro is stored in DATASOURCE_ADDIN1 and not
| MANAGE_ADDIN.
|
| Is there a way to tell excel to look in the correct add-in without
| changing the menu of the DATASOURCE_ADDIN itself?
|
| Thanks.
|
 

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