ActiveX component cant create object


S

Steve Richter

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
 
Ad

Advertisements

S

Steve Richter

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
 
Ad

Advertisements

B

Bruce Barker

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)



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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top