VB Code:
Public Function ExFunction(Func As String, Num As Integer) As Double
Select Case Func
Case "log"
ExFunction = Log(Num) / Log(10)
Case "sqrt", "sqr"
ExFunction = Sqr(Num)
Case "abs"
ExFunction = Abs(Num)
Case "int"
ExFunction = Int(Num)
Case "sin"
ExFunction = Sin(Num)
Case "cos"
ExFunction = Cos(Num)
Case "tan"
ExFunction = Tan(Num)
Case "asc"
ExFunction = Asc(Num)
Case "atn"
ExFunction = Atn(Num)
Case "ln"
ExFunction = Log(Num)
End Select
End Function
However, this makes it hard to make custom functions at runtime. I was hoping to have this ability. My initial idea was to put all the functions in a custom class, and the ability to actually call a function by name would have been nice...