Welcome to MSDN Blogs Sign in | Join | Help

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:

?PROGRAM()

 

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.

 

 

 

Published Thursday, April 05, 2007 1:26 PM by Calvin_Hsia

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Why doesn't Microsoft Excel Spreadsheet control work?

Sunday, April 08, 2007 6:32 AM by trustqf

I'm from China.

"In the BeforeKeyDown event I added this line:

?PROGRAM()

"

How to add?

Thank you!

# re: Why doesn't Microsoft Excel Spreadsheet control work?

Thursday, April 19, 2007 11:14 AM by trustqf

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

thank you.

# re: Why doesn't Microsoft Excel Spreadsheet control work?

Friday, May 18, 2007 4:55 AM by ro

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

# re: Why doesn't Microsoft Excel Spreadsheet control work?

Friday, May 18, 2007 12:03 PM by Calvin_Hsia

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.

# re: Why doesn't Microsoft Excel Spreadsheet control work?

Tuesday, September 18, 2007 3:39 AM by Kais

I looking for this control for Excel 2007.

Could someone tell me, where I can download.

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker