Your main problem is that "^" is not the Exponentiation Operator in javascript (it's a bitwise XOR operation so the results you're seeing are, in fact, quite correct) . I don't believe there is a native exponentiation operator in javascript and you'd normally use the Math.pwr function. (which wont work with the MSScript control's Eval Method) Any particular reason you're using javascript as opposed to vbscript ?
works fineCode:Temp = ScriptControl.Eval("2 * 3")
EDIT: as does
@JM: The Eval Method of MSScript expects a valid expression in a string as the argument.Code:MSScriptControl.Language = "vbscript" Dim Temp As Double Temp = MSScriptControl.Eval("2^5") Debug.Print Temp




Reply With Quote