Problem in making Excel.WorkBook from VB.NET

G

Guest

I made an application in Vb.NET that loads an excel application and then
start to generate some reports on it, my problem is:

1 - the application was running with no problems and after formatting my PC,
installing Windows XP, SP2, Office 2003 + SP1, Visual studio 2003 and start
running the program it succeeded in making an excel application object, but
it faild to create a workbook or any other feature or property, except
"ExcelApp.Visible=True".

2 - when I start to debug the code, it gives me the following error " Old
format or Invalid Type Library"

3 - I checked my refrences and found that there is no problem, the
application compiles with no errors.

4 - I made my refrences by adding a refrence to excel.exe file into my
project and it adds automatically "Microsoft.Office.Core" refrence and
"VBIDE" refrence to my project.

I have tried to format my PC again and install office again and test, but it
still gives me the same error.

I have tested it on another PCs(3 different PCs) and it worked fine and
correctly with no problem

what does this error message mean?
What is its cause?
is there anything that I did not take care of after format?
what should I do in order to avoid this error message?


here is the code snippit that makes the problem:

Dim ExcelApp As Excel.Application
ExcelApp = CreateObject("Excel.Application")
ExcelApp.Visible = True

Dim WB As Excel.Workbook
WB = ExcelApp.Workbooks.Add ' <==== Here Where it Crashs and give me
the error message " Old format or Invalid Type Library"
 
N

NickHK

Wael_Bakr,
This VB.Net code ?
Look a lot like VB6 to me. Does Vb.Net use all that Interop stuff ?

NickHK
 
T

tony h

I was feeling quite confident about the answer until you said it worked
on other pcs.

I am not sure why you need a reference to the IDE but you may do, what
you haven't mentioned is a reference to the excel object reference
library.

You do need to make sure that you pick up compatible sets of libraries
otherwise you will be trying to operate on an object with two different
versions of EXCEL. Which what I suspect your error is indicating.

Hope this helps
 

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