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 anbut that doesn't work).On Error Resume Next
The uninstall function looks like this (called from the custom tab):
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):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
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 theSub 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 Subin theAddIns.Installed = Falsesection 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'.Workbook_AddinInstall()
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
Never mind, Peter from MSDN was able to help me solve this problem. For anyone else with the same problem, here is the link to the solution:
http://social.msdn.microsoft.com/For...?prof=required
I confess that, like Peter, I am not clear why you feel the need to keep uninstalling and reinstalling the addin anyway?
Good luck.
Thanks for your lack of constructive input. That's not the point. I don't post on forums to be criticised, I post to seek help because I couldn't solve the problem myself!
That was a question, not a criticism, but never mind.
Good luck.
I apologise for getting the wrong idea, but the answer to your question is written in my original post. It's so I don't have to go into the Office menu system multiple times within a short space of time to remove/add the add-in when I make small changes to my code.
That does not actually answer my question, which was really about why you have to keep uninstalling and reinstalling the addin? I frequently make changes to addin code whilst it is loaded.
Good luck.
Ironically, I have only realised that I could do that since I fixed the problem lol
Often the way!
As you have fixed your issue, can you mark the thread Solved?
PS Usually the only time you need to reload an adding is if you are holding a reference to the RibbonUI object and it goes out of scope, but you can work around that too (see Ron de Bruin's site here)
Last edited by OnErrorGoto0; 02-11-2012 at 03:22 AM.
Good luck.
I was looking for somewhere to do that, but I'm not sure how. I can't see an option anywhere...
From the FAQ link above
To mark your thread solved do the following:
- Go to the first post
- Click edit
- Click Advance
- Just below the word "Title:" you will see a dropdown with the word No prefix.
- Change to Solve
- Click Save
Good luck.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks