Microsoft® Windows® Script Host DisconnectObject Method |
WSH Reference Version 1 |
Disconnects a previously connected object from Windows Script Host.
object.DisconnectObject obj
Part Description object WScript object. obj Name of the object to be disconnected.
If the specified object is not already connected to Windows Script Host, this method does nothing.
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