2

Something like if addin exists then do nothing else add_addin("AddinName").

I have a few add-ins, when enabled would first pops up a message. So if I enable them at the excel open automatically, it becomes very annoying. If I can assign a few VBA code to do the enabling and put a quick access button for the code, then it is much easier to manage and I only need to enable them as needed.

2
  • I did, unfortunately, I haven't found a straightforward answer. There is one answer about AddIns("Title").Installed=False method, but I tried, it doesn't disable it.(At least the addin menu item is still there. Commented Nov 7, 2014 at 22:02
  • 2
    Don’t confuse the add-in title, which appears in the Add-Ins dialog box, with the add-in name, which is the file name of the add-in. You must spell the add-in title exactly as it’s spelled in the Add-Ins dialog box, but the capitalization doesn’t have to match. Commented Nov 7, 2014 at 22:10

1 Answer 1

5

NathaneilCapital since you don't have any code I will just explain the procedure for you.

Adding a new add-in and installing it (make it appear on the ribbon) is very easy.

Adding an Add-In:

Copy your xlam file to the library folder using FileCopy command. You can get the address where you should copy the file TO easily like this:

sAddInPathTo = Application.UserLibraryPath

sToFullName = sAddInPathTo & "\" & "MyAddInName.xlam"

FileCopy sFromFullName, sToFullName

At this point if you go to Developer/Add-Ins you would see the name of the addIn but the checkbox next to it is not checked meaning it is not enabled/installed. To do that you can use:

AddIns("MyAddInName").Installed=True

After this line, your add-in should appear on the Excel ribbon as a new Tab.

To uninstall the add-in you can simply so this:

AddIns("MyAddInName").Installed=False

If you would do this manually, you should open up the AddInInstallerManager (Developer/Add-Ins) and uncheck your add-in.

However, removing it from the Add-Ins list in the AddInInstallerManager is more complicated. First, you should delete the xlam file from the library address which is simply done by using:

Kill sToFullName

Make sure you uninstall first, otherwise windows will not be able to delete the file.

Second, which is the most difficult part is to clean the registry. In fact after the above mentioned line, you would see the add-in name in the AddInInstallerManager, but when you browse you would not see the xlam file there, which is kind of inconsistensy. Because AddInInstallerManager lists those add-ins from an ini file. Practically if you get to this point, it is still fine and in case Excel finds out about it, it will refresh the ini file and you should be good, but to do this manually, you can open the AddInInstallerManager and when you click on the name of the add-in, it will throw and error for you and then it will remove it from its list. You can do this either but using send keys to simulate it or simply modify the registry. See this for more information:

http://www.jkp-ads.com/articles/addinsandsetupfactory.asp

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.