Excel File

J

jessi

Hello,

I need to open an excel Workboot from an existing excel file, but I get the
following error:

Old format or invalid type library

Here is my code:

Dim oExcel As Excel.Application
oExcel = New Excel.Application
Dim oWorkbook As Excel.Workbook
oWorkbook =
oExcel.Workbooks.Open(Filename:=Request.ServerVariables("APPL_PHYSICAL_PATH")
& "otrapruebamas.xls") 'This line generates the exception
Dim x As String = oWorkbook.Worksheets(1).Range("A1").Value

I need help, thanks!!
 
G

Guest

jessi said:
Hello,

I need to open an excel Workboot from an existing excel file, but I get
the following error:

Old format or invalid type library

Here is my code:

Dim oExcel As Excel.Application
oExcel = New Excel.Application
Dim oWorkbook As Excel.Workbook
oWorkbook =
oExcel.Workbooks.Open(Filename:=Request.ServerVariables("APPL_PHYSICAL_PATH")
& "otrapruebamas.xls") 'This line generates the exception
Dim x As String = oWorkbook.Worksheets(1).Range("A1").Value

BUG: "Old format or invalid type library" error when automating Excel
http://support.microsoft.com/kb/320369
 
J

jessi

Solution:

System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture("en-Us")

Dim oExcel As Excel.Application

oExcel = New Excel.Application

Dim oWorkbook As Excel.Workbook

oWorkbook =
oExcel.Workbooks.Open(Filename:=Request.ServerVariables("APPL_PHYSICAL_PATH")
& "otrapruebamas.xls")
 
M

Mark Rae

Solution:

System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture("en-Us")

Dim oExcel As Excel.Application

oExcel = New Excel.Application

Dim oWorkbook As Excel.Workbook

oWorkbook =
oExcel.Workbooks.Open(Filename:=Request.ServerVariables("APPL_PHYSICAL_PATH")
& "otrapruebamas.xls")

You'll be *very* fortunate indeed if this works in a live production
environment...

It almost certainly won't...
 
M

Mark Rae


For precisely the reasons outlined by Microsoft in the link that I gave you
in my first reply...

Is there any particular reason why you didn't read it...???
 
S

sloan

Jessi.

Mark is trying to help you, by giving you a article about ~why not to do
this.

Instead of asking "why", try reading the article.... and then if you need to
ask specific questions about the the article, then do so.

But put a little legwork in...esp when someone is trying to ~help you avoid
a pitfall.
 

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

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top