Re: Error when using CreateObject in client side VBScript.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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
|
|
|
|
|


.



Relevant Pages

  • Re: Login failed for user (null)
    ... > Steve, thank you very much. ... > Best Regards, ... >> Usually you can impersonate users by going to the Local security policy ... >> then go to the Local security policy and add users there. ...
    (microsoft.public.sqlserver.clients)
  • Re: Basic question
    ... Set objNetwork = CreateObject ... Regards ... >> Steven Burn ... >> Ur I.T. Mate Group ...
    (microsoft.public.scripting.vbscript)
  • Re: Run-time error 429
    ... > Run-time error '429' ... > ActiveX component can't create object ... > thanks and regards ... Malke ...
    (microsoft.public.windowsxp.general)
  • changing security policy
    ... I am researching API to change local security policy programatically. ... Can anyone help me with routines, COM objects, interfaces related to the ... Peter Kuschak ...
    (microsoft.public.win32.programmer.wmi)
  • Windows 2003. IIS 6.0. ActiveX component cant create object: CDONTS.NewMail
    ... Windows 2003. ... IIS 6.0. ... ActiveX component can't create object: ... With best regards, ...
    (microsoft.public.inetserver.asp.db)