How to add DatePicker in Excel AddIn Ribbon RRS feed

  • Question

  • Hi ,

    Could any give some idea how can we add date picker control in Ribbon item in Excel Add-In.

    I created a user control and added the date picker, but any idea how to put this user control in Ribbon.




    Thursday, December 18, 2014 3:21 PM


  • Hi Fayaz,

    As far as I know, we can't add custom user controls to the Ribbon. We can only use built-in Ribbon controls to customize the Ribbon UI Elements. Please take a look at this thread and the MSDN document:

    How to add a Date Picker control in my office word, excel, outlook, powerpoint ribbon addin

    Ribbon Overview

    But as a workaround, you could use CustomTaskPane to host the date picker user control. Create a UserControl with date picker in your project, then create a CustomTaskPane in the ThisAddIn class. To show or hide this CustomTaskPane, you could create a Ribbon button, change the Visible property of the CustomTaskPane.

    private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;
            private MyUserControl myUserControl = new MyUserControl();
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
                myUserControl = new MyUserControl();
                myCustomTaskPane = CustomTaskPanes.Add(myUserControl, "My Custom Task Pane");
                myCustomTaskPane.Visible = true;
                myCustomTaskPane.Width = 500;
    public partial class Ribbon1
            private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
            private void button1_Click(object sender, RibbonControlEventArgs e)
                var myCustomTaskPane = Globals.ThisAddIn.CustomTaskPanes.Where(t => t.Title == "My Custom Task Pane").FirstOrDefault();
                myCustomTaskPane.Visible = !myCustomTaskPane.Visible;

    Check this MSDN document for more information about CustomTaskPane:

    Custom Task Panes

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 19, 2014 6:40 AM