Sub Convert Values Class

SwapNonObjects

Swap two values that are not Objects or DataObjects. Assumes that the arguments are of compatible types.

Signature (Visual Basic / VBA)

Public Sub SwapNonObjects( _
      ByRef rOne As Variant _
    , ByRef rTwo As Variant _
    )

Code Examples

    Assuming
       Dim varOne As Variant
       Dim varTwo As Variant
       varOne = "1"
       varTwo = "2"
    for example
       SwapNonObjects varOne, varTwo
    leaves
       varOne = "2"
       varTwo = "1"
    Integer and Variant with Integer value.
    String and Variant with String value.
    Double and Variant with Long value.
    Variant with Integer value and Variant with String value.

Parameters

Parameter Description
rOne Value which is to be swapped with that of rTwo.
rTwo Value which is to be swapped with that of rOne.

Notes & Version History

Details For example, the following types of arguments would be compatible:
Note This function modifies both of its arguments (or it generates an error if it cannot do so, such as when one has a String value and the other is has an Integer value and the variables are not Variants).
v1.3 Addition This Subroutine is similar in function to that of the SwapVariants function in previous versions of Entisoft Tools. In v1.3 if Entisoft Tools, SwapVariants has been modified to handle variables of any type, including specifically, Objects and Data Objects.