ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   InvalidCastException with .NET (https://www.excelbanter.com/excel-programming/327930-invalidcastexception-net.html)

Samba

InvalidCastException with .NET
 
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


Alvin Bruney [MVP - ASP.NET]

InvalidCastException with .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
"Samba" wrote in message
...
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




Samba

InvalidCastException with .NET
 
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 [MVP - ASP.NET]" wrote:

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" wrote in message
...
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





Richard Kitson via OfficeKB.com

InvalidCastException with .NET
 
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.

Samba

InvalidCastException with .NET
 
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

"Richard Kitson via OfficeKB.com" wrote:

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.



All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com