Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment problem!

Status
Not open for further replies.

Lyubomyr

Programmer
Jul 23, 2005
21
UA
Hi!
I have a problem. Probebly it is environment problem.

I need to generate Excel report from my VB.net application.
So, I connected the Excel refernce.
On the line:
Code:
_Workbook workbook = workbooks.Add (XlWBATemplate.xlWBATWorksheet);
[\code]
program terminates and i have:
Old format or invalid type library exception

I tried standart samples from MSDN I have the same
Scaned internat all samples give me the same exception

I suppose that it's something wrong with Environment settings

Please help.
Hope you get your tip
 
VB.NET application and you use : _Workbook workbook = workbooks.Add (XlWBATemplate.xlWBATWorksheet); ?
It is rather a C# syntax, so no need to convert :)
 
My bad the I placed from identical code which i wrote in C#

my code in vb.net looks like this
Code:
        Dim xlApp As Excel.ApplicationClass
        Dim xlWb As Excel.WorkbookClass
        Dim xlSh As Excel.WorksheetClass

        xlApp = CreateObject("Excel.Application")
        xlApp.Visible = True

        xlWb = xlApp.Workbooks.Add()

By the way i still thick that is the environment problem. I scaned the problem in the i-net and found on the microsoft a tip which says that it should be installed .NET Programmability Support in my MS Office I did so but the problem remained.

Exception :
Old format or invalid type library
 
Question, what library are you using? and what version of office do you have installed. I'm not positive on this, but if you are using the Offce 9 library, but have Office XP installed, you may get an old format/invalid lib error.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
The problem is that I use Microsoft Excel 11.0 Object Library. And I use Office 2003
 
thats fine

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
yes it is . But it doesn't work

- exception:
Old format or invalid type library

 
I'd say remove the references and try either other excel/office libraries, or just re-add those libs. It really sounds to me like the issue is the lib you are using does not match the version of office you have installed.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top