Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Excel (2002) Automation - ComException when trying to add an event.

2 views
Skip to first unread message

Thibault

unread,
Aug 24, 2009, 9:58:31 AM8/24/09
to
Hi everyone,

I'm running against a problem since a couple of days and can't figure
out a solution.
To make it simple, I'm trying to execute the code provided by the
Microsoft Help and Support website: http://support.microsoft.com/kb/303018
.
I'm compiling the code with Visual Studio 2008 under Windows XP
Professional SP2.
I have Office XP (2002) SP3 installed and the Office XP PIA DLL.

It compiles but when I run it I get this exception:
"System.Runtime.InteropServices.COMException with an HRESULT of
0x80040202".

It appears when the code tried to add an event to a CommandBarButton:

---
Office._CommandBarButtonEvents_ClickEventHandler oButtonHandler =
new Office._CommandBarButtonEvents_ClickEventHandler(oButton_Click);
oButton.Click += oButtonHandler; //Thrown exception
---

I tried the same code on another machine with Office 2007 and PIA dll
(v12) installed
and it works perfectly! It should also work for Office XP according
the 'how to'.

I searched everywhere about this topic but did not find any
solution...
I already ask this question on the Microsoft CLR forum where I've been
told that a value could be wrong in the WinError.h SDK file...

Any help will be greatly appreciated!
Thanks in advance.

--
Thibault

0 new messages