Name
Set Statement
Syntax
Setobjectvar= (objectexpression| NewclassnameNothing)
objectvarUse: Required
Data Type: Object
The name of the object variable or property.
objectexpressionUse: Optional
Data Type: Object
An expression evaluating to an object.
NewUse: Optional
Type: Keyword
Creates a new instance of an object defined using the
Class...EndClassconstruct, or with the syntax New RegExp instantiates the Regular Expression object.classnameUse: Required
Data Type: String literal
The name of the class defined by the
Class...EndClassconstruct to be instantiated.NothingUse: Optional
Type: Keyword
Assigns the special data type
Nothingtoobjectvar, thereby releasing the reference to the object.
Description
Assigns an object reference to a variable or property.
Rules at a Glance
objectvardoesn’t hold a copy of the underlying object; it simply holds a reference to the object.If the
Newkeyword is used is used to instantiate a VBScript class defined using theClass...End Classconstruct, a new instance of the class is immediately created and its Class Initialize event fires. This applies only to classes defined using theClass...End Classconstruct.You can also instantiate a Regular Expression object with the
Newkeyword by using a statement like the following:Set oRegExp = New RegExp
All classes defined by the
Class...EndClassconstruct can be created using theNewkeyword. For external objects, the application’s object model determines which objects can be created and which cannot.If
objectvar ...