Ribbon Not Loading. Error: The Ribbon/COM Add-in helper required by add-in [My Addin Name] Add-In could not be registered

1,094 views
Skip to first unread message

Ptownbro

unread,
Mar 3, 2016, 7:08:03 PM3/3/16
to Excel-DNA

This has happened to me twice now.

 

All of a sudden while making changes to and testing my project, the ribbon has stopped loading and I get the error message described in the title of this post. I’ve read the other posts with a similar problem and those solutions have not worked for me. 


The first time it happened, after trying all of the suggestions I found, I ended up stripping down the code to it’s bare bones leaving only the test code I started out with. When I did that, it still didn’t work. Then, I tried copying the exact code to a new/different project and then it worked fine. So.... It seems that somewhere along the way Excel has decided not to allow the ribbon that is under the name of my old project name for some reason. Therefore, what I did was ended up rebuilding my whole project under a different name. I figured there must have been something in my code causing the problem and rather than look for it, I went the lazy route and just started over (I had just started so it wasn’t too big of a deal).

 

However… now it’s doing it again under my new project name! So something is up and I'm concerned about being able to use ExclDNA as a long term solution since there appears to be a miss somewhere.


Things I tried/notes:

  1. The UDFs in the add-in work fine. It's just the ribbon that doesn't load
  2. I can see from Excel the add-in listed as a "Disabled Application Add-in" under "File > Option > Add-ins". Then, under "Manage: COM Addins" I see it listed in the "COM Add-ins" dialog box as unchecked.
  3. I've tried re/checking it (while still in debug mode in Visual Studio), but when I go back to Excel the Ribbon still doesn't work. Then, when I go back to the "COM Add-ins" dialog box it becomes unchecked again.
  4. I've tried to remove it from the "COM Add-ins" dialog box, but clicking its "Remove" command button and started over. But, when testing again, the same problem occurs.
  5. I've tried searching for the name in my Registry to manually delete it (though I don't think this is a good, long term solution). However, I wasn't able to find the project name anywhere except in the registry strings for recent files and projects (e.g. MRUItems).
  6. When it happened the second time, I was periodically getting add-in error messages from Excel itself (not ExcelDNA). I ignored them thinking it was a VS hiccup as I was switching back and forth between the applications and when I told Excel to ignore, everything worked.

My code:


MyAddin.dna:

<DnaLibrary Language="VB" Name="My Add-in" RuntimeVersion="v4.0">
   
<ExternalLibrary Path="MyAddin.dll" />
   
<CustomUI>
       
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
           
<ribbon startFromScratch="false">
               
<tabs>
                   
<tab id="MyAddinTabId" label="MyAddin" tag="My Add-in" insertAfterMso="TabAddIns">
                       
<group id="MyAddinGroupId" label="TestArea">
                           
<button id="CreateTableOfContents" tag="CreateTableOfContents" onAction="RunTagMacro" label="&amp;Table of Contents" screentip="Insert TOC worksheet" size="normal" imageMso="TableOfFiguresInsert" />
                       
</group>
                   
</tab>
               
</tabs>
           
</ribbon>
       
</customUI>
   
</CustomUI>
</DnaLibrary>


Ribbon.vb:
Imports Microsoft.Office.Interop
Imports ExcelDna.Integration
Imports ExcelDna.Integration.CustomUI
Imports System.Runtime.InteropServices

<ComVisible(True)> _
Public Class Ribbon
   
Inherits CustomUI.ExcelRibbon
End Class

MyAddin.vb
Public Module MyAddin
   
Sub CreateTableOfContents()
       
MsgBox("CreateTableOfContents")
   
End Sub

   
Public Function MyFunction() As String
       
MyFunction = "This is working."
   
End Function
End Module


















Govert van Drimmelen

unread,
Mar 4, 2016, 5:20:05 AM3/4/16
to exce...@googlegroups.com
Is this right:
> I can see from Excel the add-in listed as a "Disabled Application Add-in" under "File > Option > Add-ins". 

Then it should work if you re-enable the add-in.
Excel disables your ribbon if there are unhandled exceptions thrown from the ribbon-handler routines. Also if you debug Excel, then stop debugging in the middle of a ribbon-handler routine.

I think the registry entries for disabled add-in are under:
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Resiliency\DisabledItems 
(Replace 15.0 with the appropriate version)

But the name of the add-in is not in there as text, which is probably why you didn't find it.

My best guidance is the ribbon's GetCustomUI() and all handler routines should be wrapped in exception handlers, so that unhandled exceptions are not leaked from these.

-Govert

 

From: exce...@googlegroups.com [exce...@googlegroups.com]
Sent: 04 March 2016 02:08 AM
To: Excel-DNA
Subject: [ExcelDna] Ribbon Not Loading. Error: The Ribbon/COM Add-in helper required by add-in [My Addin Name] Add-In could not be registered

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Ptownbro

unread,
Mar 4, 2016, 6:47:44 PM3/4/16
to Excel-DNA
Thanks! That fixed it. I was able to find the registry entries and delete both of them. Now both my first and second attempts are working.

I'll look into implementing the GetCustomUI() method. Sounds like a good suggestion.


Ptownbro

unread,
Mar 4, 2016, 6:56:53 PM3/4/16
to Excel-DNA
Sorry. One more question.  If I use the "GetCustomUI()" method:

Would it be better to store my ribbon text for the "customUI" in an external XML file or some other type of file that I can then read into a text variable from the "GetCustomUI()" method?

That way I can take advantage of the text editing features of VS, intellisense, etc...

If so, would I set that external files "Copy to Output Director" to "Do not copy" or "Copy always/if newer"?

Govert van Drimmelen

unread,
Mar 5, 2016, 1:32:14 AM3/5/16
to exce...@googlegroups.com
There is a setting in Excel: File -> Options -> Advanced -> General -> "Show add-in user interface errors" which will let Excel show any errors in your customUI xml. It's very useful.

Putting the customUI xml in the .dna file is fine, even errors in the xml there won't lead to a disabled add-in (it just doesn't show the ribbon at all). The disabled add-in comes from having your own code in GetCustomUI() that then throws an exception.

If you want to put it in a separate file and load it yourself in GetCustomUI you can embed it as a resource in your VB/C# assembly. Then use the "ResourceManager" class to extract and return it.

-Govert



From: exce...@googlegroups.com [exce...@googlegroups.com]
Sent: 05 March 2016 01:56 AM
To: Excel-DNA
Subject: Re: [ExcelDna] Ribbon Not Loading. Error: The Ribbon/COM Add-in helper required by add-in [My Addin Name] Add-In could not be registered

Reply all
Reply to author
Forward
0 new messages