Well sort of -- using ExecuteGlobal...
str = "Class MyClass" & vbcrlf
str = str & " Function MyFunction(Parameter)" & vbcrlf
str = str & " MsgBox Parameter" & vbcrlf
str = str & " End Function" & vbcrlf
str = str & "End Class"
ExecuteGlobal str
Dim obj
set obj = new MyClass
obj.MyFunction("Test")
--
Michael Harris
MVP Scripting
Hi
Does anyone know how to create dynamic Objects in VBS and have Methods Named
dynamically. I know that objects and Methods can be created dynamically with
JScript.
JScript Sample:
------------
function myClass() {
this.myFunction = _myFunction;
Quote:
}
function _myFunction(Parameter) {
alert(Parameter);
Quote:
}
var obj = new myClass();
obj.myFunction('Test');
VBS Ssample:
-------------
Class MyClass
Function MyFunction(Parameter)
MsgBox Parameter
End Function
End Class
Dim obj
obj = new MyClass
obj.MyFunction("Test")
Conrad