That method would be slow, and a waste of resources (especially if you don't also close the object!)
Of course as you said, they are not hard to implement.. Here's an example of how you could create the Max function:
Code:
Function MyMax(ParamArray TheValues() As Variant) As Variant
'Return the "highest" of the values
Dim intLoop As Integer
Dim varCurrentMax As Variant
varCurrentMax = TheValues(LBound(TheValues))
For intLoop = LBound(TheValues) + 1 To UBound(TheValues)
If TheValues(intLoop) > varCurrentMax Then
varCurrentMax = TheValues(intLoop)
End If
Next intLoop
MyMax = varCurrentMax
End Function
Example usage:
Code:
MsgBox MyMax(10, 20, 3, 17)
..note that it would be more efficient/accurate to use proper data types rather than Variants, but then you would need separate functions for each data type (or group, as Long/Int/Byte could all be covered by a single Long version).