Function Fix Ups Class

FixUpVariantBounds

Return True if there is at least one element in array vArray between elements rLowerBound and rUpperBound. Assigns default values to missing rLowerBound and rUpperBound arguments using the actual bounds of the array.

Signature (Visual Basic / VBA)

Public Function FixUpVariantBounds( _
      ByRef vArray() As Variant _
    , Optional ByRef rLowerBound As Variant _
    , Optional ByRef rUpperBound As Variant _
    , Optional ByVal vDimension As Variant _
    ) As Boolean

Code Example

    Assuming
       Dim varLower1 As Variant
       Dim varUpper1 As Variant
       Dim avarData() As Variant
       ReDim avarData(0 to 5, 0 to 20)
    for example
       FixUpVariantBounds(avarData(), varLower1, varUpper1, 1) = True
    leaves
       varLower1 = 1
       varUpper1 = 5

Parameters

Parameter Description
vArray The array of Variant values whose lower and upper bounds may be examined if either rLowerBound or rUpperBound are missing.
rLowerBound Numeric value representing the lower bound of some dimension within array vArray. rLowerBound defaults to 1 (one) if it is missing or Null or cannot be fixed-up to a number.
rUpperBound Numeric value representing the upper bound of some dimension within array vArray. rUpperBound defaults to the upper bound of the specified dimension in vArray (UBound(vArray, vDimension)) if it is missing or Null or cannot be fixed-up to a number.
vDimension The dimension within array vArray whose bounds are to be examined in case a default value must be supplied for rUpperBound. vDimension defaults to 1 (one) if it is missing or Null or cannot be fixed-up to a number.

Notes & Version History

Note Function actually only determines if rLowerBound <= rUpperBound. It does not insure that rLowerBound and rUpperBound are within the bounds of the specified dimension of vArray.