473,320 Members | 2,029 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,320 software developers and data experts.

VB.Net (in ASP.Net) won't create instance of Excel

I was able to get procedure to work in a VB.Net Windows application, and want
to get it to work within a ASP.Net page. It won't create the instance of
Excel. It blows up on the CreateObject class.

What am I missing?

Code, Error and Stack info are as follows:

Code:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
xlApp = CreateObject("Excel.Application") '**** Blows-up here *****

Error Exception Details:
System.Exception: Cannot create ActiveX component.

Stack Trace:
[Exception: Cannot create ActiveX component.]
Microsoft.VisualBasic.Interaction.CreateObject(Str ing ProgId, String
ServerName)
ReserveDB.WebForm1.btCreateDB_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\ReserveDB\WebForm1.aspx.vb:40
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
Thanks, Mark
Nov 19 '05 #1
6 2157
"=?Utf-8?B?TWFyaw==?=" <Ma**@discussions.microsoft.com> wrote in
news:FF**********************************@microsof t.com:
I was able to get procedure to work in a VB.Net Windows application,
and want to get it to work within a ASP.Net page. It won't create the
instance of Excel. It blows up on the CreateObject class.

What am I missing?

Code, Error and Stack info are as follows:

Code:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
xlApp = CreateObject("Excel.Application") '**** Blows-up here
*****


Is Excel loaded on the server?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Or is the user account running ASP.NET app (ASPNET/Network Service) allowed
to run Excel on the server?

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"=?Utf-8?B?TWFyaw==?=" <Ma**@discussions.microsoft.com> wrote in
news:FF**********************************@microsof t.com:
I was able to get procedure to work in a VB.Net Windows application,
and want to get it to work within a ASP.Net page. It won't create the
instance of Excel. It blows up on the CreateObject class.

What am I missing?

Code, Error and Stack info are as follows:

Code:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
xlApp = CreateObject("Excel.Application") '**** Blows-up here
*****


Is Excel loaded on the server?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #3
Microsoft (and I) recommend not using COM Interop with Microsoft Office
products from an ASP.NET web page. Excel was not designed to be used in
this way. If you're determined to do it anyway, these articles gives you
the ins and outs along with some better alternatives:

http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx

And here's a good 3rd party component you could use:
http://www.aspose.com/Products/Aspose.Excel

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
I was able to get procedure to work in a VB.Net Windows application, and
want
to get it to work within a ASP.Net page. It won't create the instance of
Excel. It blows up on the CreateObject class.

What am I missing?

Code, Error and Stack info are as follows:

Code:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
xlApp = CreateObject("Excel.Application") '**** Blows-up here
*****

Error Exception Details:
System.Exception: Cannot create ActiveX component.

Stack Trace:
[Exception: Cannot create ActiveX component.]
Microsoft.VisualBasic.Interaction.CreateObject(Str ing ProgId, String
ServerName)
ReserveDB.WebForm1.btCreateDB_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\ReserveDB\WebForm1.aspx.vb:40
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
Thanks, Mark

Nov 19 '05 #4
Norman -

Two questions:
What do I have to do to allow Excel to be opened by ASP.Net?

(per your comment to my similar posting on dotnet.general) How do I
cross-post?

Thank you for your comments.

Mark

"Norman Yuan" wrote:
Or is the user account running ASP.NET app (ASPNET/Network Service) allowed
to run Excel on the server?

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"=?Utf-8?B?TWFyaw==?=" <Ma**@discussions.microsoft.com> wrote in
news:FF**********************************@microsof t.com:
I was able to get procedure to work in a VB.Net Windows application,
and want to get it to work within a ASP.Net page. It won't create the
instance of Excel. It blows up on the CreateObject class.

What am I missing?

Code, Error and Stack info are as follows:

Code:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
xlApp = CreateObject("Excel.Application") '**** Blows-up here
*****


Is Excel loaded on the server?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/


Nov 19 '05 #5
Steve -

Thanks for your comments.

All I am trying to do is open an existing Excel workbook and execute a VBA
procedure contained in the workbook. And then close the workbook. I'm
really using ASP.Net (with VB) as a controller/wrapper. No biggie.

ASP.Net returns an error when I try to open the Excel instance (see error
message below). Is it a security issue? If so how can I fix it?

Thanks, Mark


"Steve C. Orr [MVP, MCSD]" wrote:
Microsoft (and I) recommend not using COM Interop with Microsoft Office
products from an ASP.NET web page. Excel was not designed to be used in
this way. If you're determined to do it anyway, these articles gives you
the ins and outs along with some better alternatives:

http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx

And here's a good 3rd party component you could use:
http://www.aspose.com/Products/Aspose.Excel

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
I was able to get procedure to work in a VB.Net Windows application, and
want
to get it to work within a ASP.Net page. It won't create the instance of
Excel. It blows up on the CreateObject class.

What am I missing?

Code, Error and Stack info are as follows:

Code:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
xlApp = CreateObject("Excel.Application") '**** Blows-up here
*****

Error Exception Details:
System.Exception: Cannot create ActiveX component.

Stack Trace:
[Exception: Cannot create ActiveX component.]
Microsoft.VisualBasic.Interaction.CreateObject(Str ing ProgId, String
ServerName)
ReserveDB.WebForm1.btCreateDB_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\ReserveDB\WebForm1.aspx.vb:40
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
Thanks, Mark


Nov 19 '05 #6
Yes, it is a security issue, which I've covered fairly thoroughly here:
http://SteveOrr.net/articles/ExcelExport.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
Steve -

Thanks for your comments.

All I am trying to do is open an existing Excel workbook and execute a VBA
procedure contained in the workbook. And then close the workbook. I'm
really using ASP.Net (with VB) as a controller/wrapper. No biggie.

ASP.Net returns an error when I try to open the Excel instance (see error
message below). Is it a security issue? If so how can I fix it?

Thanks, Mark


"Steve C. Orr [MVP, MCSD]" wrote:
Microsoft (and I) recommend not using COM Interop with Microsoft Office
products from an ASP.NET web page. Excel was not designed to be used in
this way. If you're determined to do it anyway, these articles gives you
the ins and outs along with some better alternatives:

http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx

And here's a good 3rd party component you could use:
http://www.aspose.com/Products/Aspose.Excel

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
>I was able to get procedure to work in a VB.Net Windows application, and
>want
> to get it to work within a ASP.Net page. It won't create the instance
> of
> Excel. It blows up on the CreateObject class.
>
> What am I missing?
>
> Code, Error and Stack info are as follows:
>
> Code:
> Dim xlApp As Microsoft.Office.Interop.Excel.Application
> xlApp = CreateObject("Excel.Application") '**** Blows-up here
> *****
>
> Error Exception Details:
> System.Exception: Cannot create ActiveX component.
>
> Stack Trace:
> [Exception: Cannot create ActiveX component.]
> Microsoft.VisualBasic.Interaction.CreateObject(Str ing ProgId, String
> ServerName)
> ReserveDB.WebForm1.btCreateDB_Click(Object sender, EventArgs e) in
> c:\inetpub\wwwroot\ReserveDB\WebForm1.aspx.vb:40
> System.Web.UI.WebControls.Button.OnClick(EventArgs e)
>
> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
> eventArgument)
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
> sourceControl, String eventArgument)
> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
> System.Web.UI.Page.ProcessRequestMain()
>
>
> Thanks, Mark


Nov 19 '05 #7

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

Similar topics

7
by: Martin | last post by:
I have a situation where I'm displaying some information in a table on a web page. I've given the user the ability to make several different "queries" and show different sub-sets of the data. I...
1
by: tkaleb | last post by:
I have to create output file in a text, MS Access, MS Excel and .dbf format from C# Win/ADO.NET application. Data are collected in DataSet and there is no problem to make text file. However, I have...
3
by: Michael Tkachev | last post by:
Hello, I need to create an "Excel" file in the ASP.net. But a security system doesn't allow to do it. What can I do? There is an exception heppens when I try to execute the following row: ...
27
by: jeniffer | last post by:
I need to create an excel file through a C program and then to populate it.How can it be done?
1
by: Venkat | last post by:
Can we create an Excel Addin with VC++.net? We are developing an application in c# which interacts with Excel application. The UI will be Excel and based on the inputs given through excel I...
0
by: kennedystephen | last post by:
For the life of me, I cannot get this ... I have 1 excel document. I want to open that document and copy the first 50 rows to a new document. Then get the next 50 rows and copy those to a brand...
8
by: yogarajan | last post by:
hi All how can i create new excel sheet through asp.net (with c#) i have create report in aspx (with c#) and i store data in excel sheet also so user can select view report through web page or...
0
by: th12345 | last post by:
Hi All, I want to create custom excel sheet page in my web application like how Google spreadsheet was created. I do not want load data into Microsoft excel sheet. Please give some idea...
0
by: Pete Kane | last post by:
Hi All, does anyone know if it's possible to utilise a .NET class library from Excel 97 ? I've tried but receive a runtime error -2146232576 which means nothing to me, my class is shown below, I've...
4
by: =?Utf-8?B?Sm9zaW4gSm9obg==?= | last post by:
I could create MS Excel sheet using ASP.NET 2.0 with C# but it is not being created in some systems, following error occurs when the program compiles : Microsoft Office Excel cannot open or...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.