7

I created an Excel Addin that appears in the UI, but whenever I click it it doesn't work.

Option Explicit

Public sheetscol As Collection, depshtnm
Public hasdeps As Boolean
'***********************************
'*finds the external dependencies of the cell, and places them in the 'sheetscol' collection
'***********************************
Sub depfinder_eventhandler(control As IRibbonControl)
    depfinder
End Sub
'--------------
Sub depfinder
 ...
End sub

This is the XML CustomUI:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
  xmlns:m="MattSinSpace">
    <ribbon>
        <tabs>
            <tab idQ="m:MattTab" label="Matt Tools" insertAfterMso="TabHome">
                <group idQ="m:migration" label="migration tools">
                    <button idQ="m:DepFinderButton1" label="Highlight Dependencies" size="large"
                     onAction="depfinder_eventhandler"                         imageMso="HappyFace" />
        </group>
                <group idQ="m:RS1" visible = "false"/>
            <group idQ="m:RS2" visible = "false"/>
            </tab>
        </tabs>
    </ribbon>
</customUI>

I'm pretty amateurish at making add-ins, and I've been using this page to help me out:

http://erpcoder.wordpress.com/2012/05/30/how-to-create-a-custom-ribbon-addin-for-excel-2010/

It appears that things are fine, in my code and my UI, the only difference is that I've included the namespace.

Lance Roberts
  • 22,383
  • 32
  • 112
  • 130
sterlingalston
  • 655
  • 1
  • 6
  • 6

1 Answers1

5

Your problem lies within the XML for the group and buttons. You are using idQ which is a qualifier identifier used when sharing controls between add-ins. You want this in the tab since you may share the tab between add-ins but not the group or buttons. The following XML will work:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:m="MattSinSpace">
<ribbon>
    <tabs>
        <tab idQ="m:MattTab" label="Matt Tools" insertAfterMso="TabHome">
                <group id="migration" label="migration tools">

        <button id="DepFinderButton1" label="Highlight Dependencies" size="large"
                 onAction="depfinder_eventhandler"  imageMso="HappyFace" />

        </group>

           <group id="RS1" visible = "false"/>
             <group id="RS2" visible = "false"/>
        </tab>
    </tabs>
</ribbon>

CuberChase
  • 4,458
  • 5
  • 33
  • 52
  • 1
    This page talks about the various attributes of the button, but you can find all you'll need in the overarching documentation. http://msdn.microsoft.com/en-us/library/dd925416%28v=office.12%29.aspx I've found the XML to be very fickle, this is a great resource for the ribbon: http://www.rondebruin.nl/ribbon.htm. If you like the answer can you accept it :) – CuberChase Jan 12 '13 at 02:12