View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.automation
Velislav Velislav is offline
external usenet poster
 
Posts: 3
Default Excel interop from c#

Hi, hope you can shed some light.

I have a C# app which does some Excel interop. I didn't write the app
and I got e-mailed the executable which is used in production.

I then went and found the source code for it.

Now this thing directly references a Excel.dll (version 1.2.0.0) and
there's also an Office.dll (version 2.2.0.0), which I assume is used
by the Excel dll.

Same scenario with the project file.

When I run the production executable, it works just fine and dandy.

However, when I run the app from Visual Studio (this is 2003 - .NET
1.1), it throws the wonderful error "Exception from HRESULT:
0x800A03EC." when the following code runs:

System.Reflection.Missing missing = System.Reflection.Missing.Value;
Excel.Application app = new Excel.ApplicationClass();
workbook =
app.Workbooks.Open(fileName,updateLinks,readOnly,m issing,missing,missing,true,missing,missing,missin g,missing,missing,false);

After some extensive googling I have found that the most common cause
for this is a US English version of Office running on a non-US English
version of Windows (mine is South African English). So I promtly
changed my regional settings to US-English, I even programatically
changed the thread's CultureInfo to en-US, as explained somewhere on
MSDN. Still I get the error.

I tried changing the references in the project to the interop dlls in
the GAC, still nothing.

There are a few other COMException error descriptions which correspond
to the same HRESULT, which to me is a bit puzzling, but anyway, that's
the most detailed error description I get... "Exception from HRESULT:
0x800A03EC."

I am sitting here pulling my hair out... if anyone has any idea what's
up... I would be eternally grateful...

Cheers!