<-- Previous || Up || Next -->

Swap Variants Sub
Convert Values Class

Public Sub SwapVariants( _
      ByRef rOne As Variant _
    , ByRef rTwo As Variant _

Swap two values.
Assumes that the arguments are of compatible types.

For example, the following types of arguments would be compatible:
    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.
       Dim varOne As Variant
       Dim varTwo As Variant
       varOne = "1"
       varTwo = "2"
    for example
       SwapVariants varOne, varTwo
       varOne = "2"
       varTwo = "1"
See also:
    SwapNonObjects Subroutine
    SwapCharacters Function
rOne: Value which is to be swapped with that of rTwo.
rTwo: Value which is to be swapped with that of rOne.
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 BugFix: This Subroutine has been fixed to support the swapping of Object and DataObject type Values.
v1.5 Pro Note: Changed the implementation of this function to require one less comparison.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.