2

I'm currently working on office ribbon customisation, but I cannot succeed to display a messageBox when I click on a simple button. I already saw this post, but signature looks fine. Moreover, even if I do exactly the same as it's specified on MSDN reference (here), can't get results.

Here is my XML code:

 <?xml version="1.0" encoding="utf-8" ?>
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
      <ribbon>
        <tabs>
          <tab id="TEST" label="TEST">
            <group id="group1" label="Example">
              <button id="myButton" label="myButton" onAction="MyButtonOnAction" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>

And C#:

using [...]

namespace MyRibbonAddIn
{
    public partial class ThisAddIn
    {
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }

        protected override Office.IRibbonExtensibility CreateRibbonExtensibilityObject()
        {
            return new MyRibbon();
        }


        public void MyButtonOnAction(Office.IRibbonControl control)
        {
            if (control.Id == "myButton")
            {
                System.Windows.Forms.MessageBox.Show("Button clicked!");
            }
        }


        *Code généré par VSTO*
    }
}

Any idea ?

Community
  • 1
  • 1
Chefty
  • 149
  • 1
  • 13

0 Answers0