Eval Function

Syntax:

Eval(Expr[, Depth])

Group:

Miscellaneous

Description: Returns the value of the string expression as evaluated.

Parameters:

Parameter

Description

Expr

Evaluate this string value.

Depth

This integer value indicates how deep into the stack to locate the local veriables. If Depth = 0 then use the currentprocedure. If this value is omitted then the depth is 0.

Example:

Sub Main
  Dim X As String
  X = "Hello"
  Debug.Print Eval("X") 'Hello
  A
End
Sub

Sub A
  Dim X As String
  X = "Bye"
  Debug.Print Eval("X") 'Bye
  Debug.Print Eval("X",1) 'Hello
End
Sub