Method: Eval for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: Eval for VBS
Method: Eval for VBS
Evaluates an expression. If you use an expression like "x = y" , the Eval method checks if both values are equal. If, instead, you want to assign the y value to the x variable, you use the Excecute method.
vEval = Object.Eval(string)
| Object | VBS Object with this method. You do not need to specify this object. |
| string | Variant Specifies which expression to evaluate. |
| vEval | Variant Receives the result of the expression. |
The following example evaluates various expressions:
Dim MyVar1, MyVar2 MyVar1 = 1 MyVar2 = 2 Call MsgBox(Eval("MyVar1 = MyVar2 + 1")) ' Returns False Call MsgBox(MyVar1) ' Returns 1 Call MsgBox(Eval("MyVar1 = MyVar2 - 1")) ' Returns True