Microsoft® Windows® Script Host CreateObject Method |
WSH Reference Version 1 |
Creates an object specified by the strProgID parameter.
object.CreateObject(strProgID[,strPrefix])
Part Description object WScript object. strProgID The program ID of the object to create. strPrefix Optional.
If the parameter strPrefix is specified, Windows Script Host connects the object's outgoing interface to the script file after creating the object. When the object fires an event, Windows Script Host calls a subroutine whose name consists of strPrefix and the event name. For example, if strPrefix is "MYOBJ_" and the object fires an event named "OnBegin," Windows Script Host calls the "MYOBJ_OnBegin" subroutine located in the script.
The following example uses the CreateObject method to create a WshNetwork object:Set WshNetwork = WScript.CreateObject("WScript.Network")