Not loading in excel 2007

Feb 18, 2013 at 3:40 AM
Hi,
I'm trying to get a ribbon addin working under both excel 2007 and excel 2010. I'm using netoffice and exceldna.

I've managed to get everything working perfectly in 2010 but the same addin doesn't work in 2007.

Excel seems to load the xll just fine but the ribbon UI doesn't get created. I also have a messagebox open when the extension loads (both in a static constructor and in the "OnConnection" method of the ExcelRibbon subclass so its really obvious when the addin is loaded. As mentioned before, this works as expected in excel 2010.

I've tried compiling exceldna and stepping through the code as it starts up and it doesn't look like the xlAutoOpen function gets called in 2007.

Can anyone help?

I'm compiling my addin dll to .net 3.5. I'm using C# and running win7

Thanks in advance!
Coordinator
Feb 18, 2013 at 8:33 AM
Hi,

One way to see whether your add-in is being loaded, is to check for the 'Registering .....' message written in the status bar. If you don't see this, Excel is not loading your add-in at all. The most likely reason for this is that macro security set to High or Very High. In this case Excel won't even start to load your add-in.

If your add-in is loading, but the ribbon is not being displayed, the ribbon helper might be disabled, for example due unhandled exceptions thrown from ribbon handlers. Check under File->Options->Add-Ins, Manage: Disabled Items.

Otherwise, there might be a problem with the ribbon xml. The xml namespace is different under Excel 2007, so it's possible that you are trying to load an Excel 2010 ribbon's xml into 2007. (Though a 2007 scheme would work under both versions.) The best approach in this case is to start with a really simple ribbon from one of the samples.

If none of these seem to be the issue, write back and I can suggest a more methodical approach.

Regards,
Govert
Feb 18, 2013 at 9:24 AM
Thanks for the reply Govert.

When I look in the File->Options->Add in section, I see my addin in the "Active Application Add-ins" section, that means its loaded right? I've changed the macro security to "Enable all macros", is that ok?

My ribbon xml is below. I think I'm using the right namespace...
<DnaLibrary Name="myaddin">
  <ExternalLibrary Path="myaddin.dll" />
  <CustomUI>
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
      <ribbon>
        <tabs>
          <tab idMso="TabReview">
            <group id="grp" label="grp">
              <button id="recalc" label="Recalculate" onAction="Recalculate" />
              <button id="report" label="Generate Report" imageMso="QueryMakeTable" onAction="GenerateReport" />
              <button id="manual" label="User Manual" onAction="OpenUserManual" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
  </CustomUI>
</DnaLibrary>
Coordinator
Feb 18, 2013 at 9:33 AM
Hi,

Is there anything under 'Disabled Item'? The main add-in might be loaded, but there is a separate ribbon helper add-in that also needs to be loaded, and can become disabled separately.

Do the ribbon samples work?

If you are running under a restricted user, or have some security utilities installed, you should check that you can write (and create new keys) under the registry key HKEY_CURRENT_USER\Software\Classes. (For admin users, it will write to HKEY_CURRENT_MACHINE\Software\Classes).

-Govert
Feb 18, 2013 at 9:55 AM
No there is nothing under the disabled item section.

I tried loading the "TestRibbon.dna" sample but it exhibits the same behaviour. It loads without error (it is listed in "Active Application Add-ins"), but there is no "My Tab" tab in the ribbon.

I'm running as an administrative user (although I'm not running excel using "run as administrator"). But I do have write access to both of those parts in the registry
Coordinator
Feb 18, 2013 at 10:01 AM
OK - I'm grasping at straws now . . .

Are you running McAfee anti-virus?

Could you check that your TMP environment variable points to a valid directory?

Could you check when running Excel "As Administrator"?

-Govert
Feb 18, 2013 at 10:28 AM
I'm not running McAfee anti-virus.

TMP env var points to "%USERPROFILE%\AppData\Local\Temp" which does exist.

I've just tried running it as administrator and it still doesn't work... Maybe I should try re-installing excel or something... I'll see if I can try loading it on another computer and see if I get the same results. If you're baffled then it sounds like there's something "funky" happening with my machine.
Coordinator
Feb 18, 2013 at 10:42 AM
OK - I've run out of ideas for now.

(Check the other security settings, not just the Macro Security.
You can try another add-in with a ribbon, say NodeXL or a VSTO sample.)

There have been problems reported with the ribbon in the past, though not very often.
These are some of the links - maybe something rings a bell for you.
-Govert
Feb 18, 2013 at 11:20 AM
Ok thanks, I'll dig through those links and see what I can find. I've had success getting a vsto addin working so its not totally broken. I've just been unable to get exceldna working.

As I said, it worked flawlessly in 2010.
Coordinator
Feb 18, 2013 at 11:24 AM
If you are really unable to get it to work, please write again. I'd like to understand what is going on.

-Govert
Aug 15, 2013 at 12:13 PM
Hi Govert,
I'm finding the same issues macaronikazoo has experienced using the same environment - .net 3.5, win7. All works great on excel 2010 but I tried installing my addin on two separate machines running excel 2007 and found the same problem. The addin appears as active in the addin options menu, but the ribbon bar does not display. I tried all of the suggestions you listed but to no avail. Was wondering if you had uncovered any more info on what is causing this. Many thanks.

Mark
Coordinator
Aug 15, 2013 at 12:29 PM
Hi Mark,

You can check:
  1. Do UDF worksheet functions work from your add-in? (If so, then we are in the case where the ribbon does not load but the rest of the add-in is OK.)
  2. Have you check Disabled items?
  3. Do the sample ribbon add-ins work?
  4. Are you sure there is no file called ExcelDna.Integration.dll in your add-in directory (there shouldn't be).
  5. Are you clear about the different namespaces for the customUI tags for Excel 2007 and Excel 2010? (If you use the Excel 2010 namespace, it won't load under Excel 2007.)
-Govert
Aug 15, 2013 at 12:55 PM
I did get the sample ribbon add-in to work. Perhaps I will try my addin with just the ribbon logic only. I will keep you posted. thanks.
Aug 15, 2013 at 1:06 PM
Is there any wrong with embedding my ribbon xml in the c#? it does work in 2010. I also noticed that your sample uses the command bar tag where I am using ribbon tag. Will that make a difference? here's my method:

public override string GetCustomUI(string RibbonID)
    {
        string xmldoc2 = @"<?xml version='1.0' encoding='UTF-8'?>
        <customUI xmlns='http://schemas.microsoft.com/office/2006/01/customui'>
            <ribbon>
            <tabs>
                <tab id='CustomTab' label='Get Data'>
                <group id='CustomGroup1' label='Query Access' >
                    <box id='box1' boxStyle='horizontal'>
                        <button id='buttonList' size='large' label='List' onAction='OnButtonPressed' getImage='GetImage' getSupertip='GetSuperTip'/>
                    </box>
                     <box id='box2' boxStyle='horizontal'>
                        <button id='buttonRefreshAll' size='large' label='Refresh All' onAction='OnButtonPressed' getImage='GetImage' getSupertip='GetSuperTip'/>
                    </box>
                </group>
              </tab>
            </tabs>
            </ribbon>
        </customUI>";
        using (StreamReader customUIReader = new StreamReader(new MemoryStream(Encoding.ASCII.GetBytes(xmldoc2))))
        {
            string customUIData = customUIReader.ReadToEnd();
            return customUIData;
        }
    }
Coordinator
Aug 15, 2013 at 1:37 PM
You don't have to fiddle with the encoding, just return the xmldoc2 string.

-Govert
Aug 15, 2013 at 1:46 PM
ah, I had just tried that! I just about to reply that it now works! Thanks.