Hi all !
I am looking for a way to evaluate string expressions.
I know about SCRIPT control but this control can't do my job.
Basically I wish to calculate functions. Something like this:
Say I have a mathematically function: y = E(x) where E is an expression I don't know at design time. So I need to calculate y by evaluate E at run time. Something like this:
Of course the functions I need to evaluate are more complicated than this so I am looking for a general procedure.
Can you help me ?
Thank you !
I am looking for a way to evaluate string expressions.
I know about SCRIPT control but this control can't do my job.
Basically I wish to calculate functions. Something like this:
Say I have a mathematically function: y = E(x) where E is an expression I don't know at design time. So I need to calculate y by evaluate E at run time. Something like this:
Code:
Sub Test
Dim Y as Double, x As Double, E as String
x = 2
E = "x + 5"
Y = Fx(x,E)
Debug.Print Y 'Should return 7
E = "3*x+4"
Y = Fx(x,E)
Debug.Print Y 'Should return 10
End Sub
Private Function Fx(x As Double, Ex As String)
Y = Value of Ex ??????
End Function
Can you help me ?
Thank you !
Comment