In CDbl and CLng you can pass both a String expression or a Numeric expression.
Is it possible to create a Function with these possibilities?
If so, how do you do it?
Yes.
FUNCTION Foo OVERLOAD (BYVAL x AS DOUBLE) AS LONG
FUNCTION Foo OVERLOAD (BYREF x AS STRING) AS LONG
Sorry, but how do I implement this here?
Function EFormat (ByVal nValue as Long) as String
Dim as String v = Format (nValue/100, "#.00")
Function = v
End Function
Function EFormat Overload (ByVal nValue as Long) as String
Dim as String v = Format (nValue/100, "#.00")
Function = v
End Function
Function EFormat Overload (ByRef strValue as String) as String
Dim as String v = Format (Val(strValue)/100, "#.00")
Function = v
End Function
Usage:
print EFormat(1234)
print EFormat("1234")
Thanks Jose,
You are a genius.