Syntax 

Assign lhs, rhs[, Depth]


Group 

Miscellaneous 


Description 

Assign the value of the rhs to the lhs.


Parameters

Description

lhs 

This string represents the variable expression to be set.

rhs 

Evaluate this string value and assign it to the lhs expression.

Depth 

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


VBA 

This language element is not VBA compatible.


See Also 

Eval


Example

Sub Main

    Dim X As String

    Assign "X", """Hello"""

    Debug.Print X 'Hello

    A

    Debug.Print X 'Bye

End Sub

Sub A

    Dim X As String

    Assign "X", """Welcome"""

    Assign "X", """Bye""", 1

    Debug.Print Eval("X") 'Welcome

    Debug.Print Eval("X",1) 'Bye

End Sub