Sub List Class

AddOrUpdate

Add a new Value to the List unless it already exists.

Signature (Visual Basic / VBA)

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

Code Example

    Assuming
       Dim lstTemp As New List
    for example
       lstTemp.AddOrUpdate "FunctionName"
       lstTemp.AddOrUpdate "FunctionName"
    leaves
       lstTemp.Count = 1

Parameters

Parameter Description
vValue Value that will inserted into the List unless it already exists (in which case this subroutine will silently do nothing). vValue can be any type of Variant value on which comparisons can be made using the EqualLikeDataTypeFast function (vbString, numeric, vbDate, 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 or Null or cannot be fixed up to a number.