Microsoft® Windows® Script Host
DisconnectObject Method
WSH Reference
Version 1

See Also                      Applies To


Description
Disconnects a previously connected object from Windows Script Host.
Syntax
object.DisconnectObject obj
Parameters
Part Description
object WScript object.
obj Name of the object to be disconnected.
Remarks
If the specified object is not already connected to Windows Script Host, this method does nothing.
Example
The following example creates an instance of a fictitious object and connects it to the script file. The script then calls the "SomeMethod" method on the object. If an error called "Event" occurs in the object, the MyEvent_Event subroutine is called.
Set MyObject = WScript.CreateObject("SomeObject", "MyEvent")
MyObject.SomeMethod
Sub MyEvent_Event(strName)
  WScript.Echo strName
End Sub
WScript.DisconnectObject MyObject