How to invoke the javascript code from a button in the ribbon of Excel in apps for office 2013? RRS feed

  • Question

  • Hi,

    I have created a task pane application and content pane application and I was able to populate the excel sheet with the values.My requiremnet is instead of having a button in taskpane and content pane I need to have a button in ribbon on click of that button i need to invoke the javascript code which I have written for taskpane and content pane.

                type: "GET",
                url: "url",
                processData: false,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                error: function (xhr, status, error) {
                    text.value = "error: " + error;

    Onclikc of Ribbon button I need o invoke this code.

    Is there any possibility for this in apps for office?

    If its not there anyway to invoke the apps for office application from the ribbon button instead of code? if yes please provide me the sample code .

    Thanks in advance..waiting for your reply.

    Thursday, October 11, 2012 10:18 AM


All replies

  • Unfortunately, there's not a way to do this with Apps for Office.  Apps for Office cannot customize the ribbon -- only VSTO (Visual Studio Tools for Office) can.
    Thursday, October 11, 2012 7:20 PM
  • Hi Michael,

    Thanks for the reply.

    lets assume that I have created a ribbon and attached to the excel as add in,now it will bw available in all the excel sheets.On ribbon I have a button on click of that button I want to make a call to the task pane application, is it posiible?if its possible please give me some reference or sample so that I can proceed.Just I want to invoke the taskpane application on click of the button in ribbon.


    Meenakshi Nagpal

    Friday, October 12, 2012 5:34 AM
  • Yes, this is possible in VSTO -- but again, we're talking pure VSTO here, not Apps for Fffice.  So when you say "task pane application", that application will also be a VSTO application.

    Something like this code sample / blog post would do:  So the part that the Ribbon would do is  Me.CustomTaskPanes.Add(New MyUserControl(), "Product List") part to add the task pane, or, once the task pane is already added, you could simply be interacting with your user control (which is essentially your application, if the task pane is all you care about)

    Friday, October 12, 2012 6:48 PM