Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.automation
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!

  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.automation
external usenet poster
 
Posts: 78
Default Excel interop from c#

Hi, in Visual Studio, there is a place wherein you can reference DLLs of
external applications such as Word, Excel etc... In my opinion, you may have
to set the reference to Excel related objects/dlls so that the Visual Studio
recognizes it.

"Velislav" wrote:

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!


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

On Feb 14, 6:20 pm, Madhan wrote:
Hi, in Visual Studio, there is a place wherein you can reference DLLs of
external applications such as Word, Excel etc... In my opinion, you may have
to set the reference to Excel related objects/dlls so that the Visual Studio
recognizes it.


Hi Madhan, yeah I have a reference to *some* Excel interop assembly, I
have access to all the classes, i can instantiate objects and call
their methods. the problem is not visibility. The problem is either in
referencing the wrong version of the dll (I suspect when the app was
written it was using office 2000 or office XP and on my development
machine I'm running office 2003) or my windows/office/visual studio
setup.

I hope we're on the same page here :) Thanks for your input.

  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.automation
external usenet poster
 
Posts: 3
Default Excel interop from c#

OK, I found *my* problem, it seems quite app-specific, so probably
won't be helpful to others getting this mysterious error code.

Here's what's happening - the app copies a template XLS file with a
new name to a given output location. This new name is determined by
the code, and it appears in some instances it can be " ", resulting in
the template being copied to something like "C:\Location\ .xls".
Which, seems to be a valid windows filename, however, when i try to
open the file with the Excel interop code, it throws the error.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Immediate Fail: Launch Excel via Interop Doug Price Excel Discussion (Misc queries) 0 January 22nd 10 04:34 PM
PIA interop Excel - VB.net accessing Cell Chris Le Roquais Excel Programming 0 December 19th 06 08:52 PM
Export image from Excel using interop Ksım GÜLCAN Excel Programming 0 July 29th 06 11:44 AM
Excel interop versions Maik Excel Programming 2 May 16th 05 09:32 PM
Excel 2003 COM interop problems Matt Storz Excel Programming 2 December 7th 04 04:47 PM


All times are GMT +1. The time now is 11:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"