Problem using AddIns.Installed

ajryan88

New Member
Joined
Feb 8, 2012
Messages
2
Hi

I am in the process of developing a custom tab for the Excel ribbon (2007 and 2010) as an add-in (using Custom UI Editor). However, as I am sure most of you are aware, debugging an Excel add-in can be a real pain because of the process you must go to to remove the add-in and then re-add the add-in to the ribbon.

As a result, I have added a button to my tab that uninstalls the add-in, so as to save myself some time whilst I am in the process of debugging. This button works perfectly. So I decided to make another add-in with a reinstall button that would complement this tab in the following way:

- When I click on the reinstall button, my custom tab is installed and then my reinstall tab is uninstalled (in that order)
- When I click on the uninstall button on the custom tab, my reinstall tab is installed and then my custom tab is uninstalled (again, in that order)

The uninstall button still works perfectly on my custom tab. But when I click on the reinstall button on my second add-in, I get a prompt saying "Cannot run the macro ''Reinstall Adam''s Add-Ins.xlam'!Auto_Remove'. The macro may not be available in this workbook or all the macros may be disabled." but yet the custom tab still installs as it should. (Btw, I would be satisfied if I could stop the error coming up with an
Code:
On Error Resume Next
but that doesn't work).

The uninstall function looks like this (called from the custom tab):
Code:
Sub UninstallTab(control As IRibbonControl)
    On Error Resume Next
        AddIns("Reinstall Adam's Add-Ins").Installed = True
        AddIns("Adam's Add-Ins").Installed = False
    On Error GoTo 0
End Sub

And the reinstall function looks like this (called from the second add-in, which is also in its own ribbon developed with Custom UI Editor):
Code:
Sub ReinstallTab(control As IRibbonControl)
    On Error Resume Next
        AddIns("Adam's Add-Ins").Installed = True
        AddIns("Reinstall Adam's Add-Ins").Installed = False
    On Error GoTo 0
End Sub

I have also tried changing the above pieces of code so that neither of the two add-ins is attempting to uninstall itself. In this case I have put the
Code:
AddIns.Installed = False
in the
Code:
Workbook_AddinInstall()
section of the other add-in (i.e. the custom tab uninstalls the reinstall tab when it is installed, and the reinstall tab uninstalls the custom tab when it is installed). The error message is almost the same, just with ''Adam''s Add-Ins'!Auto_Add' instead of ''Reinstall Adam''s Add-Ins'!Auto_Remove'.

Please also note that everything works well if I don't attempt to uninstall the "Reinstall" tab, but I figured that there shouldn't be a problem with doing so because I can do it from the custom tab.

Can someone please help me out with this, I have been working on this for 3 days now and I am getting really frustrated, and something that was supposed to be making my life easier is actually having the opposite effect.

Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,213,511
Messages
6,114,054
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top