VariantSub
(DecimalSub, CurrencySub)
f90VB Modules
f90VBDefs, f90VBVariants
Summary
Returns the result from subtracting two variants.
Syntax
| type(VARIANT) function VariantSub | (VarLeft, VarRight, iRet) |
| type(VARIANT),intent(in):: | VarLeft |
| type(VARIANT),intent(in):: | VarRight |
| integer(HRESULT_KIND),intent(out),optional:: | iRet |
Arguments
VarLeft and VarRight [Input]
Two variant values. Must be initialized variants.
iRet [Output/Optional]
Upon return, iRet contains S_OK or an error code. See comments for more information.
Comments
The function subtracts the two provided variants using the following rules:
| If: | Function returns a: | |
| Both variants are of the string, date, character, or Boolean type | Subtraction | |
| One variant is numeric and the other is a string | Subtraction. | |
| Both variants are numeric | Subtraction. | |
| Either variant is NULL (VT_NULL) | NULL variant. | |
| Both variants are empty (VT_EMPTY) | Zero (0) of integer subtype | |
Argument iRet
Indicates success or failure of the subroutine. The following codes can be returned in this argument:
| Value returned in argument iRet | Description | |
| S_OK | Success. | |
| DISP_E_BADVARTYPE | One or both of the passed variant types are not a valid type of variant. | |
| DISP_E_TYPEMISMATCH | At least one of the variants could not be coerced to the appropriate type for this operation. | |
| E_INVALIDARG | One of the arguments is invalid. | |
| E_OUTOFMEMORY | Memory could not be allocated for the operation.. | |
Functions DecimalSub and CurrencySub work exactly the same as VariantSub, but the arguments and the return value are of type DECIMAL and CURRENCY respectively.
Examples
See example for VariantAdd.