Click to See Complete Forum and Search --> : Interception of events Excel in C#


vmsoft9
November 13th, 2002, 03:38 AM
See attachment ExcelEvents.zip

I can not solve this problem in any way.
I create object Excel and I define an interceptor

theApp = new Excel. ApplicationClass ();
theApp. WorkbookOpen + = new Excel. AppEvents_WorkbookOpenEventHandler (WbookOpen);

Further I describe function

public void WbookOpen (Excel. Workbook Wb)
{
Console. WriteLine (" GO-GO-GO! ");
}


The compiler does not swear: Build: 1 succeeded, 0 failed, 0 skipped
But, at start on performance on a line + = the mistake is given out:
An unhandled exception of type ' System. InvalidCastException ' occurred in interop.excel.dll
Additional information: the Interface not supported
Please, prompt in what I was mistaken : (