Using Workbook_AddinInstall -vs- Workbook_Open Events

B

Bill Schanks

When I create add-ins that have toolbars I always add the custom
toolbars at that time, and remove them in the Workbook_AddinUninstall
event.

I notice that most other addins (EssBase, MS Add-ins) don't do it this
way. The toolbars get added each time the add-in is loaded via the
Workbook_Open event.

Is there some type of common practice that should be used?

Is there some reason why you should choose one over the other? It seems
to me that by using the Workbook_open event it takes longer to load
Excel.
 
J

Jim Thomlinson

I always use the Install and uninstall to add items such as menu items, ...
The advantage to using install uninstall is that the menu bar persists even
if the user chooses to cancel after selecting to close Excel. Note with the
Essbase tolbar, if you choose cancel after selecting to shut down Excel the
addin is gone. I use the Open event to create objects and such becuase I need
to instatiate the objects when Excel is opened.Just my two cents but It works
well for me.
 
D

Doug Glancy

Jim and Bill,

I use WorkbookDeactivate to for uninstalling workbook-specific menus. It
has the same advantage Jim describes - it happens after the cancel prompt on
shutting down Excel.
 
D

Doug Glancy

Bill,

I've been thinking about menus a lot lately, and I had one other thought
about your post...

I've taken it to heart that it's a good practice to make all custom toolbars
temporary, so that they're deleted when Excel closes. This seems like good
practice, in that if something goes wrong and a toolbar that was supposed to
be deleted is not, then at least it's gone when Excel is restarted. This
practice doesn't seem to be compatible with building the toolbars at
AddinInstall because you won't necessarily have your toolbar the next time
Excel opens. So maybe that's a reason to use Open, or Activate?
 

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