none
The program used to create this object is Excel. RRS feed

  • Question

  • Hi,

    I've created an VSTO Excel Addin (C#). While the addin is activated in excel, I cannot use embedded Excel spreasheet objects in Word and getting the following error:

    ---

    The program used to create this object is Excel. That program is either not installed on your computer or it is not responding.

    To edit this object, install Excel or ensure that any dialog boxes in Excel are closed.

    ---

    How can I change my Excel Addin to get that working? 
    It isn't a workaround for me to disable the Excel addin (then it works, of course), so I want to permanently use the Addin in Excel, but also work with embedded excel objects in word (without using the addin).

    How to get rid of that error? What can I do as developer? Is it necessary to determine on init if Excel is used stand alone or embedded?

    Best Regards

    Andreas

    Monday, June 29, 2015 1:11 PM

Answers

  • Hi Starain,

    its the latest of Office 2013 32-bit, all updates installed.

    I've found out that the problem is caused by attaching to the WorkbookOpen event in the Addin_Startup:

    Application.WorkbookOpen += new Excel.AppEvents_WorkbookOpenEventHandler(Application_WorkbookOpen);

    Releasing the Workbook COM Object solves the issue for me:


            void Application_WorkbookOpen(Excel.Workbook Wb)
            {
                try
                {
                    UpdateMenu();
                }
                catch(Exception e) {
                    logWriter.WriteLog(appConfig, "KxAddIn_Startup: Menu cannot be updated. " + e.ToString());
                }
                finally
                {
                    Marshal.ReleaseComObject(Wb);
                }
            }

    1.) Can you reproduce the issue when you attach to the WorkbookOpen event without calling ReleaseComObject?
    2.) Is this an acceptable and secure solution to call Marshal.ReleaseComObject(Wb) in the WorkbookOpen event handler?

    Best Regards

    Andreas

    • Proposed as answer by acenetat Friday, July 10, 2015 6:51 AM
    • Marked as answer by L.HlModerator Friday, July 10, 2015 9:15 AM
    Wednesday, July 8, 2015 9:31 AM

All replies

  • Hi Andreas,

    How do you get embedded excel spreadsheet objects in word? Please provide the related code or steps.

    It is works fine if you disable that add-in, so, I think the issue is related to that add-in. What’s that add-in do? Could you provide the code of that add-in?

    Regards

    Starain


    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.

    Tuesday, June 30, 2015 6:05 AM
    Moderator
  • Hi Starain,

    Its a built-in feature of Word. You can click Insert - Object in the ribbons menu and select "Microsoft Excel Worksheet". 

    I've read that some Microsoft addins (and also other vendors) also caused the problem, so they changed something on the addin to get it working - but WHAT?

    For testing purposes, I removed the whole Addin_Startup code, so my addin does NOTHING on startup. So the simple existence of the addin in excel in enough to break the operation - I cannot edit the embedded excel sheet inside word.


    Best Regards

    Andreas

    Wednesday, July 1, 2015 11:36 AM
  • Hi Andreas,

    What’s the version of your Office? How do you deploy your add-in?

    I tried it with office 2013 with simple excel add-in that created in VS2013, it works fine.

    Do you sign a certificate and add to the Trusted Publisher?

    # Add a Trusted Publisher to a Client Computer for ClickOnce Applications

    https://msdn.microsoft.com/en-us/library/ms172241(VS.100).aspx

    On the other hand, could you reproduce that issue in other machine? If so please share a simple sample add-in project on the OneDrive.

    Regards

    Starain


    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, July 2, 2015 2:53 AM
    Moderator
  • Hi,

    I found out that it only occurs in Office 2010, not in 2013. Yes, the certificated is signed and the certificate is installed in Trusted Publishers. The addin is deployed through Visual Studio Setup (msi).

    Best Regards

    Andreas

    Thursday, July 2, 2015 2:29 PM
  • Note: I just tried on another machine with Office 2013 and it also occurs there. So its not just a Office 2010 issue.

    Best Regards
    Andreas

    Thursday, July 2, 2015 2:32 PM
  • Hi acenetat,

    Does it have the issue with simple excel add-in? Could you share the same add-in project on the OneDrive?

    Regards

    Starain


    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, July 3, 2015 1:41 AM
    Moderator
  • Hi,

    yes, it also occurs with a simple addin. I will try to provide sample code soon.

    An important remark: The problem only occurs when embedding an excel worksheet to the work document, SAVING the document and re-opening (completly restart Word). Then I can't edit the excel worksheet by double clicking the cells.

    Can you try that exact approach too, please?

    Best Regards
    Andreas

    Friday, July 3, 2015 9:08 AM
  • Hi,

    I still can’t reproduce that issue.

    What’s the detail version of your office?

    Regards

    Starain


    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.

    Monday, July 6, 2015 2:24 AM
    Moderator
  • Hi Starain,

    its the latest of Office 2013 32-bit, all updates installed.

    I've found out that the problem is caused by attaching to the WorkbookOpen event in the Addin_Startup:

    Application.WorkbookOpen += new Excel.AppEvents_WorkbookOpenEventHandler(Application_WorkbookOpen);

    Releasing the Workbook COM Object solves the issue for me:


            void Application_WorkbookOpen(Excel.Workbook Wb)
            {
                try
                {
                    UpdateMenu();
                }
                catch(Exception e) {
                    logWriter.WriteLog(appConfig, "KxAddIn_Startup: Menu cannot be updated. " + e.ToString());
                }
                finally
                {
                    Marshal.ReleaseComObject(Wb);
                }
            }

    1.) Can you reproduce the issue when you attach to the WorkbookOpen event without calling ReleaseComObject?
    2.) Is this an acceptable and secure solution to call Marshal.ReleaseComObject(Wb) in the WorkbookOpen event handler?

    Best Regards

    Andreas

    • Proposed as answer by acenetat Friday, July 10, 2015 6:51 AM
    • Marked as answer by L.HlModerator Friday, July 10, 2015 9:15 AM
    Wednesday, July 8, 2015 9:31 AM
  • Hi,

    First, based on my test, I can reproduce that issue too if add the WorkbookOpen event, and if release the workbook object, it works fine.

    Secondly, it’s better to release com object timely, I don’t find any issue after release that workbook object for now.

    Regards

    Starain


    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, July 9, 2015 3:06 AM
    Moderator
  • Hi Starain,

    Thanks for your feedback. Do I understand right that my code is ok then, and I can do it that way?

    Best Regards

    Andreas

    Thursday, July 9, 2015 8:34 AM
  • Hi Andreas,

    In my opinion, I think that workaround is ok. If you have the issue in future, please feel free to open a thread.

    Regards

    Starain


    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, July 10, 2015 1:55 AM
    Moderator