QueryInterface for interface Excel._Application failed

K

KC

Hi Gurus,
I am having problem opening an excel file from vb.net. My code looks like
this:

Dim EXL as Excel.Application
Dim wrkbook As Excel.Workbook

EXL = GetObject("", "Excel.Application")
EXL = CreateObject("Excel.Application")
wrkbook = EXL.Workbooks.Open("D:\Book1.xls")

It works fine on my Dev box. But when I move to my test server where I don't
have dotnet IDE. All I have is .NET framework 1.1 and Excel XP (same as
Dev).

It seems to work fine until it creates EXL object but it fails on "wrkbook
= EXL.Workbooks.Open("D:\Book1.xls").
The error i get is "QueryInterface for interface Excel._Application failed".

I have Microsoft Excel 10.0 library set as reference..

Has anyone encountered same problem? Please help..

Thanks..
 
S

Sarah McKenzie

KC, I have exactly the same problem when deploying a console
application built in c# .net : it runs on my local machine just
peachy but causes the same error you got when run on the server.

There is info here:
http://support.microsoft.com/?id=257757

on why Excel does not work well on a server environment.

I'm not convinced its to do with a lack of user identity, since I run
the executable while logged on as a user, and it is able to create
the excel application first. I get the error as soon as I try to do
anything interesting to the excel application, like set visible to
false, or open a worksheet.

Did you find a solution?

Sarah
 

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