How to close an add-in when there are no more References to it?
I'm writing a simple set of modular add-ins in Excel VBA.

In `Addin1.xlam`, I have selected "Tools.. References" and added `MyMenus.xlam` as a reference.

`Addin1` also has some code to close itself from a menu. But when `Addin1` closes, `MyMenus` stays open, even though it is no longer needed or referenced by anything.

I may also have `Addin2` or `Addin3` with a reference to `MyMenus`.

How can I get `MyMenus` to automatically close when no other open Project has a Reference to it?

Alternatively, how can I tell `Addin1` to "close, and also close anything I had a Reference to"?




How to close an add-in when there are no more References to it?
===

I'm writing a simple set of modular add-ins in Excel VBA.

In `Addin1.xlam`, I have selected "Tools.. References" and added `MyMenus.xlam` as a reference.

`Addin1` also has some code to close itself from a menu. But when `Addin1` closes, `MyMenus` stays open, even though it is no longer needed or referenced by anything.

I may also have `Addin2` or `Addin3` with a reference to `MyMenus`.

How can I get `MyMenus` to automatically close when no other open Project has a Reference to it?

Alternatively, how can I tell `Addin1` to "close, and also close anything I had a Reference to"?



