Sub Symbol Table Class

AddOrUpdate

Add a new definition ( Name and Value pair) into the Symbol Table or update an existing Name and Value pair. Inserting a Value with the same Name as another Value in the table causes the previous Value to be overwritten.

Signature (Visual Basic / VBA)

Public Sub AddOrUpdate( _
      ByVal vName As Variant _
    , ByVal vValue As Variant _
    , Optional ByVal vCompare As Variant _
    )

Code Example

    Assuming
       Dim stTemp As New SymbolTable
    for example
       stTemp.AddOrUpdate "FunctionName", 23
       stTemp.AddOrUpdate "FunctionName", 24
    leaves
       stTemp.Count = 1

Parameters

Parameter Description
vName The string or numeric identifier associated with the value vValue.
vValue Value that will inserted into the Symbol Table along with its identifier (or new Value that will replace the previous Value associated with Name ). vValue can be any type of Variant value (vbString, numeric, vbDate, vbObject, vbArray, etc.).
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.
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 Subroutine has been fixed to support the storage of Object and DataObject type Values.