Updating an Add-in

  • Thread starter Thread starter ExcelMonkey
  • Start date Start date
E

ExcelMonkey

I have an Add-in that I have created. Upon installing it
via Tools\Add-Ins.. It creates a new menu item. Now I am
anticipating having to update and distribute this Add-in
as time goes on. However, I will not be using an
installation program to do this. Hence there is a risk
that the user will not install it properly. If the user
does not uninstall the old version first(i.e. delete old
menu item), then upon installing the new version, the menu
item will be installed again (i.e. two menu items that are
exactly the same).

Is is possible to write code that says if upon installing,
if the menu item already exists, then delete the old one
and install the new one?
 
On Error Resume Next
application.Commandbars("Custom 1").Delete
On Error goto 0

or similar at the beginning of your install routine.
 
Add this to the top of your code, changing the name to match your button
name, assuming that you have added your button to the Tools menu. Otherwise,
you do something similar.

Dim ToolsMenu As CommandBarPopup
Set ToolsMenu = Application.VBE.CommandBars(1).FindControl(, 30007)
ToolsMenu.Controls("This is your control Name").Delete

HTH,
Bernie
MS Excel MVP
 

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

Back
Top