InvalidCastException with .NET

G

Guest

Hi,

I am trying to access Excel from .NET. Initially it was working fine. But
after sometime it is giving the exception, 'System.InvalidCastException:
QueryInterface for interface Microsoft.Office.Interop.Excel._Application
failed'. I tried reinstalling PIAs and Excel, but nothing worked.

I installed PIA's in the GAC.
I am using Excel 2002 SP-2 and VS 2003.

Thanks for your help.

-Samba
 
A

Alvin Bruney [MVP - ASP.NET]

You typically get this sort of exception with incompatible types. Is this
coming from code you wrote or from the OS? In the former, post the code. If
it's the latter, you will need to do some uninstalling and installing to
clear the issue.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
 
G

Guest

Hi,
I think it is coming from OS. Same code was working fine. It works even now
in other servers. About uninstalling and installing, do you know any
details. Meaning what components and which order. Could you help me?

Thanks,
-Samba

Alvin Bruney said:
You typically get this sort of exception with incompatible types. Is this
coming from code you wrote or from the OS? In the former, post the code. If
it's the latter, you will need to do some uninstalling and installing to
clear the issue.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
Samba said:
Hi,

I am trying to access Excel from .NET. Initially it was working fine. But
after sometime it is giving the exception, 'System.InvalidCastException:
QueryInterface for interface Microsoft.Office.Interop.Excel._Application
failed'. I tried reinstalling PIAs and Excel, but nothing worked.

I installed PIA's in the GAC.
I am using Excel 2002 SP-2 and VS 2003.

Thanks for your help.

-Samba
 
R

Richard Kitson via OfficeKB.com

Samba,

I'm having the same issues in a web farm, it works fine on 2 servers
but I get that error on the 3rd server. Did you ever find a
solution....what needed uninstalling and reinstalling and the order?

Richard.
 
G

Guest

Hi,

No. I could not find any solution so far. I re-installed all related s/w's.
But no use. My guess is that, I may have to change something in registry. But
I did not find which one. I will post it here, if I find any thing.


-Samba
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top