Why doesn’t Microsoft Excel Spreadsheet control work?

We received a bug report:


Steps to Reproduce :

Open the form designer by creating a new form.

Insert a an ActiveX control and select “Microsoft Office Spreadsheet 11.0”

Actual Results :

OLE error code 0x80040202: Unknown COM status code.

Expected Results :

A Microsoft Office Spreadsheet 11.0 control on the form.



Sure enough, I could reproduce the problem.


What’s happening?

When in the VFP form designer, the Excel spreadsheet control is created initially and property notification connections are made.

As part of this, VFP calls IConnectionPoint::Advise, which is documented to return certain values.


Excel returns 0x80040202 == EVENT_S_NOSUBSCRIBERS, which is not in the documented return values. When we try to connect property notifications, Excel queries our object for an implementation for the Spreadsheet events. It doesn’t find one because we’re designing the form, so it returns this value.

When we get this value, we fail creating the control, giving the user an error message.


If I change the code to ignore EVENT_S_NOSUBSCRIBERS, the control gets instantiated in the designer; I can add some code to some of the spreadsheet events and it fires at run time.


In the BeforeKeyDown event I added this line:



When I run the form, the IConnectionPoint::Advise is called, but this time it succeeds and events are fired.



When I hit a keystroke, I see the line being executed.




Comments (7)

  1. trustqf says:

    I’m from China.

    "In the BeforeKeyDown event I added this line:



    How to add?

    Thank you!

  2. trustqf says:

    sorry,my english is poor.:( my meaning is I can not add the activex into my form. how to add the code?

    thank you.

  3. ro says:

    where exactly do you change the code to ignore EVENT_S_NOSUBSCRIBERS? that eludes me….

  4. Calvin_Hsia says:

    I’m sorry: I should have been more clear. When I said “I change the code”  I meant that I changed the code for VFP itself where we handle hooking up events for ActiveX controls.

  5. Kais says:

    I looking for this control for Excel 2007.

    Could someone tell me, where I can download.

  6. カワイイ子ほど家出してみたくなるようです。家出掲示板でそのような子と出会ってみませんか?彼女たちは夕食をおごってあげるだけでお礼にHなご奉仕をしてくれちゃったりします

  7. YuanGuoSheng says:

    Hi Calvin,

    Could please write a sample? I do not know how to handle hooking up events for ActiveX controls.

    Many Thanks!