473,394 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Open Excel file from an aspx page

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
Nov 18 '05 #1
6 10809
Hi,

Try:

Dim oExcel As New Excel.ApplicationClass

Hope this helps
Martin
"Micke" <Mi***@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
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

Nov 18 '05 #2
This article contains the information you need to work with Excel files from
ASP.NET:
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Micke" <Mi***@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
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

Nov 18 '05 #3
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.

"Martin Dechev" wrote:
Hi,

Try:

Dim oExcel As New Excel.ApplicationClass

Hope this helps
Martin
"Micke" <Mi***@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
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


Nov 18 '05 #4
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.

"Steve C. Orr [MVP, MCSD]" wrote:
This article contains the information you need to work with Excel files from
ASP.NET:
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Micke" <Mi***@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
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


Nov 18 '05 #5
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.

"Micke" wrote:
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.

"Steve C. Orr [MVP, MCSD]" wrote:
This article contains the information you need to work with Excel files from
ASP.NET:
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Micke" <Mi***@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
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


Nov 18 '05 #6
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.CurrentCultu re
System.Threading.Thread.CurrentThread.CurrentCultu re = _
New System.Globalization.CultureInfo("en-US")
oApp.Workbooks.Add()
System.Threading.Thread.CurrentThread.CurrentCultu re = oldCI

as described in KB320369.
http://support.microsoft.com/default...EN-US;Q320369&

Thanks again, Micke.

"Steve C. Orr [MVP, MCSD]" wrote:
This article contains the information you need to work with Excel files from
ASP.NET:
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Micke" <Mi***@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
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


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a...
1
by: Micke | last post by:
I want to open Excel from an aspx page, put some records in there, format them and close the excel file. I can't open the Excel application. It says Cannot create ActiveX component. Here is the...
2
by: Micke | last post by:
I'm trying to open an Excel file from a code behind page to an aspx page. I'm getting the eror message: System.Runtime.InteropServices.COMException: Old format or invalid type library My code...
6
by: Michael Groeger | last post by:
Hi, I have an aspx page which generates an excel document and transfers it to the browser as attachment. Normally, once the document is transferred the open save dialog prompts to open or save...
3
by: mo | last post by:
I have an application that uses Reporting Services. When the user chooses to print a report, they are taken to a window that allows them to fill in parameters for the report. They then click a...
1
by: Raggie | last post by:
Gentlemen, first of all I have a general question... is it possible to open an excel file directly through the ASP.NET page without to install Excel on server? I tried something on my...
0
by: Fendi Baba | last post by:
I created an ASP.net page which opens excel. This works fine in Office 2007. However, Excel 2003 runs in an error which states "cannot read output file". Hee is the VB code and below is the ASPX...
9
by: Looch | last post by:
Was hoping I could get some insight on this. I added a text box and command button to a web page and added the code in the .vb file to open an existing Excel file based on what was typed in the...
7
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear();...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.