Quote Originally Posted by jmsrickland View Post
The ^ is a valid exponentiation operator in javascript as my example in post #2 proves it.
I'm afraid not... the only thing you have proven is that you got the answer you were expecting, and foolishly assumed it meant that everything you did was correct.

Getting the right result does not mean that any part of the method used was correct, or that any of your assumptions were correct.

Simply checking the data type of the parameter to Eval (which you even quoted) disproves your method. If you want evidence of it, change your code to use a dummy function:
Code:
Temp = Foo(5^2) 

Function Foo(bar as String) as Variant
  MsgBox bar
  Foo = bar
End Function
...even if done in another language and/or compiled to an external DLL, this will never show "5^2", it will always show "25".

Your code in post #7 may give the correct outcome, but it is rather OTT... removing ScriptControl.Eval would give the same output (but would only work for the x^y situation), using ScriptControl.Eval properly would take less code and work for most situations (including things like "(2.93^7)/3+2", and many more).

Note that your earlier claim that "you cannot perform math on a text string" shows that you don't really understand what the ScriptControl is for: running code (including math) that is contained in a string.


While it is good to try to help people, mis-leading them through a lack of understanding is counter-productive, which is one of the reasons I didn't reply before: I don't know enough about the ScriptControl or JavaScript to have been able to answer the initial question properly.