VBScript CreateObjectFunction


VBScript 参考手册Complete VBScript Reference Manual

The CreateObject function creates an object of the specified type.

Syntax

CreateObject(servername.typename[,location])

Parameters Description
servername Required. Provides the application name of this object.
typename Required. The type or class (type/class) of the object.
location Optional. Where to create the object.

Example

Example

Create a regular expression object:

<script type="text/vbscript">

txt="This is a beautiful day"
Set objReg=CreateObject("vbscript.regexp")
objReg.Pattern="i"
document.write(objReg.Replace(txt,"##"))

</script>

The output of the above example is:

Th##s is a beautiful day

Try it Yourself »

VBScript 参考手册Complete VBScript Reference Manual Other Extensions