Open Excel file from an aspx page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'm trying to open an Excel file from an aspx with following code:

Imports Excel = Microsoft.Office.Interop.Excel

Dim oExcel As New Excel.Application
Dim oBooks As Excel.Workbooks
oBooks.Open("C:\XML\PriceList.xls")

All I get is:
System.Runtime.InteropServices.COMException: Old format or invalid type
library.

Can anyone tell me what I'm doing wrong.
Thanks, Micke
 
Hi Martin,
Thanks for your answer. I'm sorry to say but I'm still having the same
problem. Do you now anything else I can try?

Micke.
 
Hi Steve,
I've read your article and think it's great. However I can not get it to
work. Do you now how I can check if there is some problem in my installation?

Micke.
 
Hi,
I had the same error as you when I used Interop.Excel for OfficeXP and I was
trying
to open Excel for Office 2003.
Try to install the same version of Office as the one for wich you have
Interop.Excel.
 
Thanks Steve and all other trying to solve my problem.
I've found what it was. The problem was in the client Regional settings for
windows. I had to put in the code:

Dim oApp As New Excel.Application()
Dim oldCI As System.Globalization.CultureInfo = _
System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = _
New System.Globalization.CultureInfo("en-US")
oApp.Workbooks.Add()
System.Threading.Thread.CurrentThread.CurrentCulture = oldCI

as described in KB320369.
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q320369&

Thanks again, Micke.
 
Back
Top