Excel Problem!

J

Jeti [work]

I have Office2003 installed, and trying to read excel file from C#. I made
ExcelWrapper class, and it worked fine until new version of offide came!
Now, when i'm trying to open workbook, i get an exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in kj.shared.data.excel10.dll
Additional information: Old format or invalid type library.

I'm using Excel 5.0 library.


any suggestions?

thanx
 
G

Guest

You're using Excel *5* ??!!! That's really ancient.
Just to give you an idea, Excel XP 2002 is Excel 10, Excel 2000 is Excel 9
.... so you're probably using something that was built for Windows 3.1 or
something, it sounds like to me...
Try updating it to Excel 9 or 10 - I'm sure I've written things against 9
that work fine on 10. Modern versions are more likely to be compatible with
each other than older ones.
Alternatively you can use Type.CreateFromProgID(progid) and
Activator.CreateInstance(Type) to invoke late binding.
 
J

Jeti [work]

You're using Excel *5* ??!!! That's really ancient.
Just to give you an idea, Excel XP 2002 is Excel 10, Excel 2000 is Excel 9
... so you're probably using something that was built for Windows 3.1 or
something, it sounds like to me...
Try updating it to Excel 9 or 10 - I'm sure I've written things against 9
that work fine on 10. Modern versions are more likely to be compatible with
each other than older ones.
Alternatively you can use Type.CreateFromProgID(progid) and
Activator.CreateInstance(Type) to invoke late binding.


Thanx for the reply,
I've tried to use Excel11 library, but the same exception occurs...
dont know what to do..
 
G

Guest

You've "tried to use Excel 11" ...mmmm..
What exactly does that mean? If you mean that you've developed against Excel
11 and tried to use it on Excel 10, then it won't work.
Develop it against the *lowest* version you plan on expecting it to run on
(but not 5!), and if it doesn't run on any *slightly* higher versions, post
the return value of exception.ToString() on the Exception, and what line of
code caused it to throw.

That's about all I can suggest at the current point in time...but if you
follow the above and give full details we might be able to get somewhere.
 
J

Jeti [work]

You've "tried to use Excel 11" ...mmmm..
What exactly does that mean? If you mean that you've developed against Excel
11 and tried to use it on Excel 10, then it won't work.

It means that i've used Microsoft Excel 11 Object Library... and the
exception remains...

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in kj.shared.data.excel10.dll
Additional information: Old format or invalid type library.


Just dont know what to do... I only have Excel 5 and Excel 11 Library
available, bit if you think that i should use Excel 10 and that it should
work, i'll get it and try...
 
G

Guest

If you write a program that references Excel 11, and you try to run that
program on a computer with Excel 10, then it probably won't work.
If you write a program that references Excel 10, and you try to run that
program on a computer with Excel 10 *or* 11, then it *should* work.

Does that make sense?
If so, are you seeing outcome that would suggest the above is wrong?
 
G

Guest

Also, have a go at implementing my suggestion of using
Type.GetTypeFromProgID("excel.application") and
Activator.CreateInstance(typExcel). This way, it shouldn't matter what
version you use, as long as its IDispatch supports the method you are trying
to call, you should be OK.
 

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