I was wondering if someone would be able to help me out with a few issues we are having.
1. We are trying to convert a string to an object. Currently we are using a switch statement to do this but would prefer not to do this to reduce the code required. This is like the VB function CreateObject however our classes are NOT "Active X" objects.
2. We are trying to convert a string to VB code. In VB this is usually done through the "eval" function which enables you to convert the string.
This eval function does not appear to exist when we are trying to use it.
Thanks in advance.
Re: Dynamic Coding
You can use the CallByName method:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">
s = "MySub"
CallByName Me, "MySub", VbMethod
i = CallByName(Me, "MyFunction", VbMethod, "a", 1)
MsgBox "Return from MyFunction is " & i
Function MyFunction(s As String, i As Integer) As String
MyFunction = s + " / " + Str(i)
</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">