Function Array Manipulations Class

OverlayVariantMatrix

Overlay a two-dimensional Variant array onto some part of another Variant array.

Signature (Visual Basic / VBA)

Public Function OverlayVariantMatrix( _
      ByRef rTo() As Variant _
    , ByRef vFm() As Variant _
    , Optional ByVal vOffset1 As Variant _
    , Optional ByVal vOffset2 As Variant _
    ) As Boolean

Code Example

    Assuming
       Static avarIn(0 To 5, 0 To 12) As Variant
       avarIn(1, 1) = "Smith"
       Static avarOut(0 To 5, 1 To 100) As Variant
    for example
       OverlayVariantMatrix(avarOut(), avarIn(), 0, 1) = True

Parameters

Parameter Description
rTo Two-dimensional array of Variant values that will be overlaid with vFm. rTo must already be dimensioned before it is passed to this function or else an error will occur.
vFm The two-dimensional array of Variants that will be overlaid onto rTo. vFm can be either Static or dynamic. If vFm is dynamic, it must be dimensioned before being passed to this function.
vOffset1 Offset for the first-dimension bounds and elements within the new array. vOffset1 defaults to 0 (zero) if it is missing or Null or cannot be fixed-up to a number.
vOffset2 Offset for the second-dimension bounds and elements within the new array. vOffset2 defaults to 0 (zero) if it is missing or Null or cannot be fixed-up to a number.

Return Value

Function currently returns True in all cases.

Notes & Version History

Note Function silently ignores cases where an element is to be copied to a location outside the bounds of the destination array.
Note rTo and vFm can be the same arrays.
v1.2 Change Changed arguments vOffset1 and vOffset2 to be Optional.