.NETGURU
excel object event handling
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.interop.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Vladimir Kryachko (VIP)
Hello,

I need to handle an Excel.Workbook.BeforeClose event in my VB.NET
application. When the framework attempts to bind the event with my handler,
it throws a System.InvalidCastException with message "No such interface
supported".
I included the relevant declarations:

Imports Excel
....
Public Class TimeReportSheet
....
Private WithEvents excelWorkBook As Workbook
....
Public Sub Form(...

    Dim excelApp As Excel.Application = Nothing
    excelApp = New Excel.Application()
    ...
    excelWorkBook = excelApp.Workbooks.Add() ' the exception is thrown here
    ...
End Sub

Private Sub Workbook_BeforeCloseEventHandler(ByRef Cancel As Boolean)
Handles excelWorkBook.BeforeClose
    Cancel = False
End Sub
....
End Class

What do I wrong?

Thanx

Reply to this message...
 
    
Vladimir Kryachko
The answer is there:
Microsoft Knowledge Base Article - 316653
(http://support.microsoft.com/default.aspx?kbid=316653)

"Vladimir Kryachko" <Vladimir Click here to reveal e-mail address> wrote in
message news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.InvalidCastException




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification