Creates a COM object.
String value indicating the programmatic identifier (ProgID) of the object you want to create.
Optional. String value indicating the function prefix.
Objects created with the CreateObject method using the strPrefix argument are connected objects. These are useful when you want to sync an object's events. The object's outgoing interface is connected to the script file after the object is created. Event functions are a combination of this prefix and the event name. If you create an object and do not supply the strPrefix argument, you can still sync events on the object by using the ConnectObject method. When the object fires an event, WSH calls a subroutine with strPrefix attached to the beginning of 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 CreateObject method returns a pointer to the object's IDispatch interface.
The Script Center Repository includes examples that use the CreateObject method that have been contributed by members of the community. In the Script Center Repository search box, type CreateObject.
The following VBScript code uses the CreateObject method to create a WshNetwork object:
Set WshNetwork = WScript.CreateObject("WScript.Network")