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

Pritcham

It might also be to do with your use of the "Filename:=" syntax which
is specific to Excel VBA in this instance

i.e. either change your use of
oExcel.Workbooks.Open(Filename:=Request.ServerVariables.......

to something like
oExcel.Workbooks.Open("Filename:=" & Request.ServerVariables.....

or find out the order of parameters passed to the Workbooks.Open()
method and skip the "Filename:=" declaration altogether as this is
only really used if you rearrange the parameters in the method call.

hope that helps
Martin
 

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