'Passing userform textbox values to a function

I'm trying to use a mathematical function entered into a userform and evaluate it at a specific point. I'm not sure if this is possible as I'm fairly new to VBA. When I enter 24 * t - 1.2 * t ^ 2 into the textbox and hit the command button I get a type mismatch error. Here's the code I'm using.

Function vel(t)

vel = TextBox1.Value

End Function

Private Sub CommandButton1_Click()
Dim outp As Long

outp = vel(5)
MsgBox outp

End Sub


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source