THE WORLD'S LARGEST WEB DEVELOPER SITE

VBScript CreateObject Function

❮ Complete VBScript Reference

The CreateObject function creates an object of a specified type.

Syntax

CreateObject(servername.typename[,location])
Parameter Description
servername Required. The name of the application that provides the object
typename Required. The type/class of the object
location Optional. Where to create the object

Example

Example

Creating a regular expression object:

<%

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

%>

The output of the code above will be:

Th##s is a beautiful day
Show Example »

❮ Complete VBScript Reference