08-04-2009, 12:35 AM
You need to do it like this:
Code:
Public Function CCInt(ByVal str As String) As Integer
If IsNumeric(str) Then
CCInt = CInt(str)
Else
CCInt = Val(str)
End If
End Function
Public Function CCLng(ByVal str As String) As Integer
If IsNumeric(str) Then
CCLng = CLng(str)
Else
CCLng = Val(str)
End If
End Function
Public Function CCByte(ByVal str As String) As Integer
If IsNumeric(str) Then
CCByte = CCyte(str)
Else
CCByte = Val(str)
End If
End Function