Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1024661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:48:37+00:00 2026-05-16T11:48:37+00:00

This is a very common problem when Excel Worksheet or Chart is embedded into

  • 0

This is a very common problem when Excel Worksheet or Chart is embedded into Word or Powerpoint. I am seeing this problem in both Word and Powerpoint and the reason it seems is the COM addin attached to Excel. The COM addin is written in C# (.NET). See the attached images for error dialogs.

I debugged the addin and found a very strange behavior. The OnConnection(…), OnDisConnection(…) etc methods in the COM addin works fine until I add an event handler to the code. i.e. handle the Worksheet_SheetChange, SelectionChange or any similar event available in Excel. As soon as I add even a single event handler (though my code has several), Word and Powerpoint start complaining and do not Activate the embedded object.

On some of the posts on the internet, people have been asked to remove the anti-virus addins for office (none in my case) so this makes me believe that the problem is somewhat related to COM addins which are loaded when the host app activates the object.

Does anyone have any idea of whats happening here?PowerPoint Error

Word Error

UPDATED 21-JUNE-2010


Found out that both Events and changes to ComAddIns collection creates problems when the embedded object is activated. I have now used the Excel::Application::UserControl property to check whether Excel is in embedded state and then skip any OnConnection(…) and OnDisconnection(…) code.

One solution to Events problem can be to move all the application level events to VBA code and call into .NET. Thereby removing all event handlers from .NET code.

There may be even more scenarios where an embedded object might fail to initialize so I choose to disable the COM addin i.e. skip the code in OnConnection(…) and OnDisconnection(…) methods altogether.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:48:37+00:00Added an answer on May 16, 2026 at 11:48 am

    Here is what I did to get rid of this annoying problem:

    1. Remove all event handlers in the .NET code and rely on the VBA Application Events i.e. Instead of handling Excel::Application::Worksheet_Activate(…) event, handle them in a VBA module and call into the addin when an event is received.
      The .NET event handlers seems to corrupt the state somehow.

    2. Disable any code that interacts with the addin in OnConnection(…) using the flag in custom param. See the following link for details on the flag:
      COM AddIns in Detail

    I mentioned about the Excel::Application::UserControl property but it is not reliable in some cases. We need to consider the following cases and the custom array param is OnConnection(…) is the most reliable:

    1. Excel started as independent application
    2. Excel started as embedded app in some other application
    3. Excel started through automation e.g. CreateObject(…)

    I preferred disabling the addin totally when Excel is in embedded mode. It depends what code you are executing in your OnConnection(…) and how other applications respond to it when executed. Point #1 has to be implemented to solve this issue.

    If anybody has a better solution to this, please let me know 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems to be a very common problem of mine: data = [1 2
This seems like a very simple and a very common problem. The simplest example
This seems to be a very common problem, although I've tried the recommendations to
OK this is a very common problem but mine is a bit different and
this question is about style, because i think this is a very common problem
I know that this is very common problem and I have gone through almost
I know this is a very common problem. I was trying to get a
Based on my research, this is a very common problem which generally has a
I am sure this is a very very common problem. I have a struts
I am having a very common problem which it seems that all the available

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.