VBScript » Events » Initialize

Version: 5.0

The Initialize event is an optional subroutine that can be called when you create an instance of a object using the Class ... End Class statement. You can place any valid VBScript code inside the subroutine that you want to run when the class is initialized.

The similar Terminate event can be called when you close an object.


Class DevGuru
   Private Sub Class_Initialize()
      'place any valid VBScript code here
   End Sub
End Class

Note, as shown in this example, that the subroutine name must be composed of the word Class, an underscore ( _ ), and the word Initialize().

Language(s): VBScript