none
c# excel addin issue with excel 2013 RRS feed

  • Question

  • Hi,

    we have developed an addin which has a ribbon control with few buttons.On click of a button ,we open a wpf window and let user to choose the excel file to be opened.After user selects excel,we open that excel using c#.The addin works fine with excel 2010 but in excel 2013,the newly opened excel on click of wpf window hangs.Nothing can be selected on the window.

    For opening excel,we are using below code:



                        wb = Globals.ThisAddIn.Application.Workbooks.Open(workbookPath,
                            missing, missing, missing, missing, missing, missing, missing,
                            missing, true, missing, missing, false, missing, missing);

    Here is handler for wpf window ok button.

     private void OkBtn_Click(object sender, RoutedEventArgs e)
            {
                var selectedDash = usersDashListBox.SelectedValue;
                if (selectedData != null)
                {
                    selectedData(selectedDash, null);
                }

                this.Close();

            }

    Note:One important observation is that if i write the code to open excel directly into the ribbon button event handler,the workbook opens fine.The issue occurs only when I open a wpf window from ribbon button and on click of ok button in wpf window,tries to open excel.
    Wednesday, May 28, 2014 12:05 PM

Answers

  • Hi Rahul,

    >> The addin works fine with excel 2010 but in excel 2013,the newly opened excel on click of wpf window hangs.Nothing can be selected on the window.<<

    Did you mean the new Excel windows stop response? I failed to reproduce the issue in Excel 2013. Here is my steps:

    1. Create Excel 2013 add-in in Visual Studio 2013
    2. Add a ribbon component (Visual Designer)
    3. Create User Control with WPF and add a button to open a workbook
    4. Create Windows Forms item and load the WPF User Control with ElementHost
    5. Add a ribbon button on the ribbon and open the Windows Forms item

    Did I miss anything?

    I suggest you trying to test whether this issue occurred in other computers. If not, I suggest you repairing and updating the Office application to see whether this issue was resolved.

    If yes, would you mind share more detail code in selectedData function or upload a sample project to help us to reproduce this issue? You can remove the sensitive information and upload it through OneDrive.

    Best regards

    Fei


    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.

    Thursday, May 29, 2014 5:29 AM
    Moderator