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!!
 
N

NickHK

Is this supposed to be in VBA or ASP ?
Or one of the .Net languages ?

It's not valid VBA.

NickHK
 
N

NickHK

You will probably get more meaningful responses in one of the groups that
deals with Interop/Net.
A complete guess, but are there limitations of which versions of Excel can
work with versions of the .Net framework ?

NickHK
 
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")

Dim x As String = oWorkbook.Worksheets(1).Range("A2").Value
 

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