Hi there

Apologies if this is not quite the correct group but I am having trouble
trying to create various objects using the VBScript CreateObject function
inside a client side HTML page. The following is the complete code of a test
page that I put together.

'===============================================
<html><head><title>Test CreateObject</title>
<script language=VBScript>
Dim objNetwork

On Error Resume Next
Err.Clear
Set objNetwork = CreateObject("WScript.Network")
If Err.Number <> 0 Then
MsgBox Err.Description
Else
MsgBox objNetwork.UserDomain
End If

Set objNetwork = Nothing

</script></head><body>
This is a test
</body></html>
'===============================================

Whenever I open this page, the CreateObject function errors and the
displayed error message is "ActiveX component can't create object". I have
tried creating various other ActiveX objects (eg Excel.Application) but
still get the same error. I know that this code is the correct syntax etc
because I have run it successfully in a VBS file (without the HTML
obviously).

I have tested the code on three machines with the following specs. All
display the same error message.
1. WinXP, SP2, IE6.0.2900
2. WinXP, SP1, IE6.0.2800
3. Win2k, SP4, IE6.0.2800

I've had a look at IE's security settings and found no problems there. Had a
look at the Local Security Policy but also found nothing. I've also had a
bit of a poke around on the internet and couldn't find anything significant
that would indicate what the problem could be.

If anyone could help me out on this, it will be greatly appreciated.

Regards
David

Re: Error when using CreateObject in client side VBScript. by Dave

Dave
Sat Oct 08 19:03:30 CDT 2005

Try saving it as an HTA

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"DJP" wrote:
| Hi there
|
| Apologies if this is not quite the correct group but I am having trouble
| trying to create various objects using the VBScript CreateObject function
| inside a client side HTML page. The following is the complete code of a
test
| page that I put together.
|
| '===============================================
| <html><head><title>Test CreateObject</title>
| <script language=VBScript>
| Dim objNetwork
|
| On Error Resume Next
| Err.Clear
| Set objNetwork = CreateObject("WScript.Network")
| If Err.Number <> 0 Then
| MsgBox Err.Description
| Else
| MsgBox objNetwork.UserDomain
| End If
|
| Set objNetwork = Nothing
|
| </script></head><body>
| This is a test
| </body></html>
| '===============================================
|
| Whenever I open this page, the CreateObject function errors and the
| displayed error message is "ActiveX component can't create object". I have
| tried creating various other ActiveX objects (eg Excel.Application) but
| still get the same error. I know that this code is the correct syntax etc
| because I have run it successfully in a VBS file (without the HTML
| obviously).
|
| I have tested the code on three machines with the following specs. All
| display the same error message.
| 1. WinXP, SP2, IE6.0.2900
| 2. WinXP, SP1, IE6.0.2800
| 3. Win2k, SP4, IE6.0.2800
|
| I've had a look at IE's security settings and found no problems there. Had
a
| look at the Local Security Policy but also found nothing. I've also had a
| bit of a poke around on the internet and couldn't find anything
significant
| that would indicate what the problem could be.
|
| If anyone could help me out on this, it will be greatly appreciated.
|
| Regards
| David
|
|
|
|
|



Re: Error when using CreateObject in client side VBScript. by Ray

Ray
Sat Oct 08 19:10:12 CDT 2005

It is IE security that is preventing the creation of those objects. Those
are objects that are NOT safe.

Ray at home



"DJP" <djp@snotmail.com> wrote in message
news:ZsY1f.11320$U51.3038@news-server.bigpond.net.au...
> Hi there
>
> Apologies if this is not quite the correct group but I am having trouble
> trying to create various objects using the VBScript CreateObject function
> inside a client side HTML page. The following is the complete code of a
> test page that I put together.
>
> '===============================================
> <html><head><title>Test CreateObject</title>
> <script language=VBScript>
> Dim objNetwork
>
> On Error Resume Next
> Err.Clear
> Set objNetwork = CreateObject("WScript.Network")
> If Err.Number <> 0 Then
> MsgBox Err.Description
> Else
> MsgBox objNetwork.UserDomain
> End If
>
> Set objNetwork = Nothing
>
> </script></head><body>
> This is a test
> </body></html>
> '===============================================
>
> Whenever I open this page, the CreateObject function errors and the
> displayed error message is "ActiveX component can't create object". I have
> tried creating various other ActiveX objects (eg Excel.Application) but
> still get the same error. I know that this code is the correct syntax etc
> because I have run it successfully in a VBS file (without the HTML
> obviously).
>
> I have tested the code on three machines with the following specs. All
> display the same error message.
> 1. WinXP, SP2, IE6.0.2900
> 2. WinXP, SP1, IE6.0.2800
> 3. Win2k, SP4, IE6.0.2800
>
> I've had a look at IE's security settings and found no problems there. Had
> a look at the Local Security Policy but also found nothing. I've also had
> a bit of a poke around on the internet and couldn't find anything
> significant that would indicate what the problem could be.
>
> If anyone could help me out on this, it will be greatly appreciated.
>
> Regards
> David
>
>
>
>
>



Re: Error when using CreateObject in client side VBScript. by DJP

DJP
Sat Oct 08 19:38:51 CDT 2005

Thanks Dave. This looks like it will do the job. However, when opening the
file, a security warning is displayed prompting to run, save or cancel the
file download. I know it is probably not possible, but do you know of any
way to stop this security warning from appearing?


"Dave Patrick" <DSPatrick@nOsPAM.gmail.com> wrote in message
news:%23IMZiTGzFHA.612@TK2MSFTNGP10.phx.gbl...
> Try saving it as an HTA
>
> --
> Regards,
>
> Dave Patrick ....Please no email replies - reply in newsgroup.
> Microsoft Certified Professional
> Microsoft MVP [Windows]
> http://www.microsoft.com/protect
>
> "DJP" wrote:
> | Hi there
> |
> | Apologies if this is not quite the correct group but I am having trouble
> | trying to create various objects using the VBScript CreateObject
> function
> | inside a client side HTML page. The following is the complete code of a
> test
> | page that I put together.
> |
> | '===============================================
> | <html><head><title>Test CreateObject</title>
> | <script language=VBScript>
> | Dim objNetwork
> |
> | On Error Resume Next
> | Err.Clear
> | Set objNetwork = CreateObject("WScript.Network")
> | If Err.Number <> 0 Then
> | MsgBox Err.Description
> | Else
> | MsgBox objNetwork.UserDomain
> | End If
> |
> | Set objNetwork = Nothing
> |
> | </script></head><body>
> | This is a test
> | </body></html>
> | '===============================================
> |
> | Whenever I open this page, the CreateObject function errors and the
> | displayed error message is "ActiveX component can't create object". I
> have
> | tried creating various other ActiveX objects (eg Excel.Application) but
> | still get the same error. I know that this code is the correct syntax
> etc
> | because I have run it successfully in a VBS file (without the HTML
> | obviously).
> |
> | I have tested the code on three machines with the following specs. All
> | display the same error message.
> | 1. WinXP, SP2, IE6.0.2900
> | 2. WinXP, SP1, IE6.0.2800
> | 3. Win2k, SP4, IE6.0.2800
> |
> | I've had a look at IE's security settings and found no problems there.
> Had
> a
> | look at the Local Security Policy but also found nothing. I've also had
> a
> | bit of a poke around on the internet and couldn't find anything
> significant
> | that would indicate what the problem could be.
> |
> | If anyone could help me out on this, it will be greatly appreciated.
> |
> | Regards
> | David
> |
> |
> |
> |
> |
>
>



Re: Error when using CreateObject in client side VBScript. by Dave

Dave
Sat Oct 08 20:32:44 CDT 2005

You may need to "Allow active content" within IE

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"DJP" wrote:
| Thanks Dave. This looks like it will do the job. However, when opening the
| file, a security warning is displayed prompting to run, save or cancel the
| file download. I know it is probably not possible, but do you know of any
| way to stop this security warning from appearing?