Add-in icon disappears from Ribbon

606 views
Skip to first unread message

Albert

unread,
Feb 14, 2012, 7:25:06 PM2/14/12
to Excel-DNA
Hi Govert,

I'm still quite new to Excel DNA so apologies if my question has an
obvious answer.

The issue:

When deploying my custom add-in to Excel, the add-in button
occasionally disappears from the main after a couple of days/weeks for
some users (but for most users, the ExcelDNA add-in remains).

Clues:

- I can't reproduce this from my development machine. I have Admin
privileges.
- Users don't have Admin privileges.
- A reset of their user profile (renaming the user's Documents and
Settings\username folder) and forcing Windows to recreate the user
profile folder appears to fix the problem.
- However, the problem sometimes recurs for the same user, even after
resetting their profile, and no new deployments of my Excel add-in
made.
- Going into the Excel Add-ins window, unchecking MyAddIn (so
removing the Addin) then manually re-adding the MyAddIn.xll file does
not fix the problem.
- Deployment simply involves copying the new DLLs into the same
folder as the XLL file. There is a script to modify the Excel registry
that installs the Addin (just adds a new OPEN registry key at Software
\Microsoft\Office\12.0\Excel\Options). There's also an uninstall
script that calls a regasm /unregister of the app DLL.
- We're about to compare "before" and "after" user profile folders
for users who experienced this problem. Hopefully that should shed a
bit more light.

Any ideas?

Thanks,
Albert

Some sample source code:

////////////////////
// MyAddIn.cs
////////////////////
public class MyAddIn : IExcelAddIn
{
#region Implementation of IExcelAddIn

public void AutoOpen()
{
// Maybe add this to register types when add-in is
loaded,
// instead of calling "regsvr32 MyAddIn.xll".
// It is exactly the code that runs when "regsvr32" is
run.
ComServer.DllRegisterServer();
}

public void AutoClose()
{
ComServer.DllUnregisterServer();
}

#endregion
}


////////////////////
// MyRibbon.cs
////////////////////

[ComVisible(true)]
[Guid("19720E5D-AD20-45B2-AC99-D77589F315F7")]
public class TigerExcelRibbon : ExcelRibbon
{
public override void OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
ExcelApp =
(Microsoft.Office.Interop.Excel.Application)application;
}

public override void OnStartupComplete(ref Array custom)
{
ExcelApp.WorkbookOpen += this.ExcelApp_WorkbookOpen;

Application.EnableVisualStyles();
}

....

public override string GetCustomUI(string ribbonId)
{
return Resources.CustomUI;
}


public void RibbonOnLoad(IRibbonUI ribbonUi)
{
MyRibbon.ribbonUi = ribbonUi;
}

public stdole.IPictureDisp GetImage(string imageName)
{
return
Utils.ImageToIPictureConverter.Convert(Resources.MyIcon.ToBitmap());
}
....
}

Govert van Drimmelen

unread,
Feb 15, 2012, 2:54:57 AM2/15/12
to Excel-DNA
Hi Albert,

Your add-in is most probably being 'Disabled' by Excel. You can check
whether the addin is disabled by pressing the Excel button ('File' in
Excel 2010), then Options -> Add-Ins.
At the bottom of the form, it says 'Manage' with a dropdown box.
Select 'Disabled Items' and "Go..."

You might find something like AddIn.XXXXX there - this is the COM
helper that Excel-DNA registers for the ribbon. The add-in should work
again after you enable everything.

These threads mention similar happenings:
http://groups.google.com/group/exceldna/browse_frm/thread/cd4a3bcc7ee76741
http://groups.google.com/group/exceldna/browse_frm/thread/bd7e921078407241

----

How does this happen?
Excel wraps some operations in a safety check, e.g. when loading your
add-in. If your add-in causes Excel to crash it will detect it, and
would prompt you to disable the add-in in future.

I've had reports of some interaction between Excel-DNA add-ins, so
that one crashing add-in that is disabled would also prevent the
loading of ribbons interfaces from other add-ins. I've not been able
to reproduce this, and don't understand why there would be such
interference between add-ins.

I'm a little worried by your running Regasm (though you asy only on
the uninstall). That's never needed with Excel-DNA, and might cause
some trouble with RTD servers or Custom Task Pane controls if you use
these.

----
Let us know if you your add-in was indeed 'Disabled'.

Regards,
Govert

Albert Teoh

unread,
Feb 19, 2012, 6:57:48 PM2/19/12
to exce...@googlegroups.com
Hi Govert,

It appears that the add-in wasn't disabled (not on the disabled addins list). It apparently even shows that the relevant .xll is being loaded (on the botton status panel) when loading Excel.

The windows admin also compared the user profiles and he couldn't find anything excel related that has changed from the time when the add-in was visible to the time when it disappeared. 

I'll forward your email to him. He tells me that he will no longer unregister the dll with regasm and will just copy the new Dlls into the relevant folder. Fingers crossed!

Thanks for your prompt and useful suggestions. I may get in contact again with you later.

Albert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.


Jeffrey Shek

unread,
May 23, 2014, 7:00:57 PM5/23/14
to exce...@googlegroups.com
I recognize this thread is quite old, but at the moment I'm running into a very similar issue.

I've been unable to replicate this on my local developer machines, but we have a user that is reporting a situation where Excel DNA installs fine, but randomly the plugin will disappear.

Upon investigation, the COM Add-In component gets removed from the active add-ins, but the main plugin is still there. IE. The COM that describes "Dynamically created COM Add-in to load custom UI, etc" 

Installation works fine, and the first open of Excel after installation, our plugin will appear. Shortly after the user closes and reopens Excel, it disappears again. The current use is Excel 2010, 32bit, but I haven't found the root of the problem yet. Any thoughts here that I might be able to try?

Many thanks,
Jeff
Albert

To unsubscribe from this group, send email to exceldna+unsubscribe@googlegroups.com.

Govert van Drimmelen

unread,
May 24, 2014, 2:28:07 AM5/24/14
to exce...@googlegroups.com
Hi Jeff,

Have you checked whether there is anything in the "Disabled Items" list after the problem occurs?

If so, it is most likely due to an unhandled exception in a ribbon event handler.
Excel traps these and disables the COM add-in hosting the ribbon from loading in future.

-Govert


From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of Jeffrey Shek [jeff...@ycharts.com]
Sent: 24 May 2014 01:00 AM
To: exce...@googlegroups.com
Subject: Re: [ExcelDna] Re: Add-in icon disappears from Ribbon

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.
Reply all
Reply to author
Forward
0 new messages