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

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFyaw==?=, Aug 10, 2005.

  1. 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(String 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.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    System.Web.UI.Page.ProcessRequestMain()


    Thanks, Mark
    =?Utf-8?B?TWFyaw==?=, Aug 10, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?TWFyaw==?=

    Lucas Tam Guest

    "=?Utf-8?B?TWFyaw==?=" <> wrote in
    news::

    > 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 ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
    Lucas Tam, Aug 10, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?TWFyaw==?=

    Norman Yuan Guest

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

    "Lucas Tam" <> wrote in message
    news:Xns96AEB3825160Dnntprogerscom@127.0.0.1...
    > "=?Utf-8?B?TWFyaw==?=" <> wrote in
    > news::
    >
    > > 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 ()
    > Please delete "REMOVE" from the e-mail address when replying.
    > http://members.ebay.com/aboutme/coolspot18/
    Norman Yuan, Aug 11, 2005
    #3
  4. 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" <> wrote in message
    news:...
    >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(String 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.IPostBackEventHandler.RaisePostBackEvent(String
    > eventArgument)
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    > sourceControl, String eventArgument)
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    > System.Web.UI.Page.ProcessRequestMain()
    >
    >
    > Thanks, Mark
    Steve C. Orr [MVP, MCSD], Aug 11, 2005
    #4
  5. 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" <> wrote in message
    > news:Xns96AEB3825160Dnntprogerscom@127.0.0.1...
    > > "=?Utf-8?B?TWFyaw==?=" <> wrote in
    > > news::
    > >
    > > > 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 ()
    > > Please delete "REMOVE" from the e-mail address when replying.
    > > http://members.ebay.com/aboutme/coolspot18/

    >
    >
    >
    =?Utf-8?B?TWFyaw==?=, Aug 12, 2005
    #5
  6. 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" <> wrote in message
    > news:...
    > >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(String 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.IPostBackEventHandler.RaisePostBackEvent(String
    > > eventArgument)
    > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    > > sourceControl, String eventArgument)
    > > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    > > System.Web.UI.Page.ProcessRequestMain()
    > >
    > >
    > > Thanks, Mark

    >
    >
    >
    =?Utf-8?B?TWFyaw==?=, Aug 12, 2005
    #6
  7. 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" <> wrote in message
    news:...
    > 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" <> wrote in message
    >> news:...
    >> >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(String 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.IPostBackEventHandler.RaisePostBackEvent(String
    >> > eventArgument)
    >> > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    >> > sourceControl, String eventArgument)
    >> > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    >> > System.Web.UI.Page.ProcessRequestMain()
    >> >
    >> >
    >> > Thanks, Mark

    >>
    >>
    >>
    Steve C. Orr [MVP, MCSD], Aug 12, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. yvan
    Replies:
    3
    Views:
    577
    David Rushby
    Jul 18, 2003
  2. Sandra-24
    Replies:
    18
    Views:
    1,843
    Steve Holden
    Apr 29, 2006
  3. Jona
    Replies:
    2
    Views:
    442
    Victor Bazarov
    Jul 6, 2007
  4. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,484
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  5. Q. John Chen

    Render to Excel - only one excel instance

    Q. John Chen, Aug 28, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    195
    Q. John Chen
    Aug 28, 2006
Loading...

Share This Page