ActiveX component cant create object

Discussion in 'ASP .Net' started by Steve Richter, Apr 14, 2005.

  1. running a simple vbscript in an .htm page that starts excel and loads
    the spreadsheet with the contents of a <table> ... </table>

    getting an "Error: ActiveX component cant create object.
    Excel.Application" error.

    <script language="vbscript">
    Sub TableToExcel_onclick
    Dim sHTML, oExcel, oBook
    sHTML = document.all.item("DataGrid1").outerHTML
    Set oExcel = CreateObject("Excel.Application")
    Set oBook = oExcel.Workbooks.Add
    oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
    oBook.HTMLProject.RefreshDocument
    oExcel.Visible = true
    oExcel.UserControl = true
    End Sub
    </script>

    This script works when when I navigate to the .htm file via a c: drive
    physical path:
    c:\inetpub\wwwroot\DemoSite\Vb­ScriptTest.htm

    but it fails with the above described message when I navigate to it
    via:
    http://localhost/demosite/VbSc­ript1.htm

    I dont think it is a permission issue because I gave ASPNET, the IIS
    user on my system, administrator rights, just to rule that possiblity
    out.

    any ideas why my script fails to CreateObject( 'Excel.Application' )??

    thanks,

    -Steve
    Steve Richter, Apr 14, 2005
    #1
    1. Advertising

  2. the reason for this error is a security setting in IE:
    - tools, internet options, security
    - activex controls and plugins
    - "initialize and script activex controls not marked as safe"
    - in my IE, this option was set to "disable"

    any idea how excel or any other activex control can be marked as safe?

    -Steve


    Steve Richter wrote:
    > running a simple vbscript in an .htm page that starts excel and loads
    > the spreadsheet with the contents of a <table> ... </table>
    >
    > getting an "Error: ActiveX component cant create object.
    > Excel.Application" error.
    >
    > <script language="vbscript">
    > Sub TableToExcel_onclick
    > Dim sHTML, oExcel, oBook
    > sHTML = document.all.item("DataGrid1").outerHTML
    > Set oExcel = CreateObject("Excel.Application")
    > Set oBook = oExcel.Workbooks.Add
    > oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
    > oBook.HTMLProject.RefreshDocument
    > oExcel.Visible = true
    > oExcel.UserControl = true
    > End Sub
    > </script>
    >
    > This script works when when I navigate to the .htm file via a c:

    drive
    > physical path:
    > c:\inetpub\wwwroot\DemoSite\Vb­ScriptTest.htm
    >
    > but it fails with the above described message when I navigate to it
    > via:
    > http://localhost/demosite/VbSc­ript1.htm
    >
    > I dont think it is a permission issue because I gave ASPNET, the IIS
    > user on my system, administrator rights, just to rule that possiblity
    > out.
    >
    > any ideas why my script fails to CreateObject( 'Excel.Application'

    )??
    >
    > thanks,
    >
    > -Steve
    Steve Richter, Apr 14, 2005
    #2
    1. Advertising

  3. Steve Richter

    Bruce Barker Guest

    that can not be marked safe, because they aren't. you will need to convince
    your users to trust your site. in IE they can add your site to trusted site
    and raise permission level. the other is to have them download the hta to a
    local disk. the local disk is usually trusted (though not on my machine).

    -- bruce (sqlwork.com)



    "Steve Richter" <> wrote in message
    news:...
    the reason for this error is a security setting in IE:
    - tools, internet options, security
    - activex controls and plugins
    - "initialize and script activex controls not marked as safe"
    - in my IE, this option was set to "disable"

    any idea how excel or any other activex control can be marked as safe?

    -Steve


    Steve Richter wrote:
    > running a simple vbscript in an .htm page that starts excel and loads
    > the spreadsheet with the contents of a <table> ... </table>
    >
    > getting an "Error: ActiveX component cant create object.
    > Excel.Application" error.
    >
    > <script language="vbscript">
    > Sub TableToExcel_onclick
    > Dim sHTML, oExcel, oBook
    > sHTML = document.all.item("DataGrid1").outerHTML
    > Set oExcel = CreateObject("Excel.Application")
    > Set oBook = oExcel.Workbooks.Add
    > oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
    > oBook.HTMLProject.RefreshDocument
    > oExcel.Visible = true
    > oExcel.UserControl = true
    > End Sub
    > </script>
    >
    > This script works when when I navigate to the .htm file via a c:

    drive
    > physical path:
    > c:\inetpub\wwwroot\DemoSite\Vb­ScriptTest.htm
    >
    > but it fails with the above described message when I navigate to it
    > via:
    > http://localhost/demosite/VbSc­ript1.htm
    >
    > I dont think it is a permission issue because I gave ASPNET, the IIS
    > user on my system, administrator rights, just to rule that possiblity
    > out.
    >
    > any ideas why my script fails to CreateObject( 'Excel.Application'

    )??
    >
    > thanks,
    >
    > -Steve
    Bruce Barker, Apr 14, 2005
    #3
    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. Rodney

    Activex Cant create object

    Rodney, Oct 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    493
    Rodney
    Oct 14, 2004
  2. =?Utf-8?B?QWJoaXNoZWs=?=

    ActiveX component can't create object

    =?Utf-8?B?QWJoaXNoZWs=?=, Aug 21, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    507
    =?Utf-8?B?QWJoaXNoZWs=?=
    Aug 21, 2006
  3. Nagaraj
    Replies:
    1
    Views:
    840
    Lionel B
    Mar 1, 2007
  4. Steve Kershaw
    Replies:
    4
    Views:
    6,832
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 17, 2007
  5. rami4tis
    Replies:
    1
    Views:
    1,620
    Norman Yuan
    Sep 23, 2009
Loading...

Share This Page