Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Open Excel file from an aspx page

Reply
Thread Tools

Open Excel file from an aspx page

 
 
=?Utf-8?B?TWlja2U=?=
Guest
Posts: n/a
 
      10-11-2004
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
 
Reply With Quote
 
 
 
 
Martin Dechev
Guest
Posts: n/a
 
      10-11-2004
Hi,

Try:

Dim oExcel As New Excel.ApplicationClass

Hope this helps
Martin
"Micke" <> wrote in message
news:2046171D-3619-4D31-A062-...
> 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



 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      10-11-2004
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" <> wrote in message
news:2046171D-3619-4D31-A062-...
> 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



 
Reply With Quote
 
=?Utf-8?B?TWlja2U=?=
Guest
Posts: n/a
 
      10-12-2004
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" <> wrote in message
> news:2046171D-3619-4D31-A062-...
> > 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

>
>
>

 
Reply With Quote
 
=?Utf-8?B?TWlja2U=?=
Guest
Posts: n/a
 
      10-12-2004
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" <> wrote in message
> news:2046171D-3619-4D31-A062-...
> > 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

>
>
>

 
Reply With Quote
 
=?Utf-8?B?TWlja3k=?=
Guest
Posts: n/a
 
      10-12-2004
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" <> wrote in message
> > news:2046171D-3619-4D31-A062-...
> > > 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

> >
> >
> >

 
Reply With Quote
 
=?Utf-8?B?TWlja2U=?=
Guest
Posts: n/a
 
      10-12-2004
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" <> wrote in message
> news:2046171D-3619-4D31-A062-...
> > 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

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Open an Excel File in Excel, not HTML viza HTML 0 07-07-2008 11:04 PM
Syntax for call from aspx page to .cs file then to different aspx page MadHatter51 ASP .Net 1 05-17-2006 10:43 AM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
Open Excel form an aspx page =?Utf-8?B?TWlja2U=?= ASP .Net 1 09-10-2004 11:01 AM
How do I post data from aspx page to another aspx page. Sriram Mallajyosula ASP .Net 1 11-05-2003 04:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57