Function Symbol Table Class

Lookup

Lookup and return the Value associated with a Name . Function returns True if the Name was found and its Value was returned via rValue. Function returns False otherwise.

Signature (Visual Basic / VBA)

Public Function Lookup( _
      ByRef rValue As Variant _
    , ByVal vName As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Boolean

Code Example

    Assuming
       Dim stTemp As New SymbolTable
       stTemp.Add "FunctionName", 23
       stTemp.Add "FunctionName", 24
       Dim bResult As Boolean
       Dim varData As Variant
    for example
       bResult = stTemp.Lookup(varData, "FunctionName")
    leaves
       bResult = True
       varData = 24

Parameters

Parameter Description
rValue The value that will be returned if the lookup is successful. vValue can be any data type (vbString, numeric, vbDate, vbObject, vbArray, etc.) as long as it is compatible with the Value to be returned.
vName The string or numeric identifier whose value is to be returned.
vCompare Specifies the type of string comparison used to determine if Names match. vCompare defaults to the value of the Compare Property if it is missing.

Notes & Version History

v2.0 Change Changed the vCompare argument so that it can no longer be Null or non-numeric. It is still Optional though, so it can be missing.
Note If there are multiple Symbol Table definitions with the same Name , this function will return the Value from the one that was mostly-recently-added.
Performance This function can be inefficient because it scans the Symbol Table from end to beginning looking for the spefied Name .
v1.3 BugFix This Function has been fixed to support the storage of Object and DataObject type Values.