Error Code 424- Object Required 
Author Message
 Error Code 424- Object Required

Okay, someone please tell me what I am doing wrong.  This VBSript creates on
error on my webpage.  It is error 424- object required.  Does anyone know
why.  The script works perfectly as a .vbs but I am trying to make them work
on a webpage with onclick events

<html>
<head>
<SCRIPT Language= VBScript>

sub printer_onclick
On Error Resume Next
errN = Document.frm1.errcode.value
Err.Raise (errN)

If eErr.Number <> 0 then
Alert "Error No:" & Err.Number & " - " & Err.Description
Err.Number=0
End If

set wshNetwork = CreateObject("WScript.Network")

Dim Input
Input = InputBox("What Do you want as your default printer (1-8)?" & VBcrlf
& VBcrlf & "1= Clinical (at Mount Clare)" & VBcrlf & "2= Admissions" &
VBcrlf & "3= The Front Desk" & VBcrlf & "4= Administration" & VBcrlf & "5=
Clinical Suite at HRC" & VBcrlf & "6= Robert's" & VBcrlf & "7= Vic's" &
VBcrlf & "8= Medical's", "Default Printer")

If Input = 1 Then
 wshNetwork.SetDefaultPrinter "\\bbh01\HP 4100 - Clinical - Clare"

ElseIf Input = 2 then
 wshNetwork.SetDefaultPrinter "\\bbh01\HP 4000 - Admissions"

ElseIf Input = 3 then
 wshNetwork.SetDefaultPrinter "\\bbh01\HP 4000 - Front Desk"

ElseIf Input = 4 then
 wshNetwork.SetDefaultPrinter "\\bbh01\HP 4000 - Business Office"

ElseIf Input = 5 then
 wshNetwork.SetDefaultPrinter "\\bbh01\HP 4100 - Clinical - HRC"

ElseIf Input = 6 then
 wshNetwork.SetDefaultPrinter "\\bbh01\HP 4100 - Business Office"

ElseIf Input = 7 then
 wshNetwork.SetDefaultPrinter "\\victoria\HP 4500"

ElseIf Input = 8 then
 wshNetwork.SetDefaultPrinter "\\medical\HP LaserJet 4000 - Medical"

ElseIf Input > 8 then
 MsgBox ("You Need to Enter a Number Between 1 and 8")

Else
End If

End Sub
</SCRIPT>
</head>
<BODY>
<input type = "button" name = "printer" value = "Setting Default Printer">
</body>
</html>



Sun, 02 Oct 2005 21:00:38 GMT  
 Error Code 424- Object Required

Quote:

> Okay, someone please tell me what I am doing wrong.  This VBSript
> creates on error on my webpage.  It is error 424- object required.
> Does anyone know why.  The script works perfectly as a .vbs but I am
> trying to make them work on a webpage with onclick events

set wshNetwork = CreateObject("WScript.Network")

is failing but you are hiding the error with a global On Error Resume Next
(not a good practice).  WScript.Network is not safe for scripting in IE.
Change the page's extension to .hta and it will work since the mshta.exe
host doesn't have the security restrictions of iexplore.exe.

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US

Technet Script Center
http://www.microsoft.com/technet/scriptcenter/default.asp



Mon, 03 Oct 2005 11:53:42 GMT  
 Error Code 424- Object Required
thank you, that worked like a charm.

BTW, I agree with you about the On Error Resume Next thing, but unfornetely
in IE it wouldn't give me the error code and description without it.  In
standard vbs, I never use it- as I want to see if there is anything I need
to fix.

But thanks again.  I was beginning to read on Outlook Forms because I was
trying to find somehow how to do the client side scripting from a form.

Robert



Quote:

> > Okay, someone please tell me what I am doing wrong.  This VBSript
> > creates on error on my webpage.  It is error 424- object required.
> > Does anyone know why.  The script works perfectly as a .vbs but I am
> > trying to make them work on a webpage with onclick events

> set wshNetwork = CreateObject("WScript.Network")

> is failing but you are hiding the error with a global On Error Resume Next
> (not a good practice).  WScript.Network is not safe for scripting in IE.
> Change the page's extension to .hta and it will work since the mshta.exe
> host doesn't have the security restrictions of iexplore.exe.

> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US

> Technet Script Center
> http://www.microsoft.com/technet/scriptcenter/default.asp



Mon, 03 Oct 2005 20:09:18 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Error 424 (Object required) when creating an object - ???

2. VBscript - Error 424 Object Required - NEED a FIX

3. Error Message 424 - Object Required

4. Error Message 424-Object Required

5. Automation error... Error 424, Object Required

6. Error Starting application executable (error 424 - Object required)

7. run-time error 424 object required

8. Run-time error '424': Object required

9. Runtime error 424: Object required

10. Error 424 Object Required

11. Run-Time error '424': object Required

12. Clipboard.Clear - Returns Error 424 - Object Required

 

 
Powered by phpBB® Forum Software