I suggest stopping them from introducing anything other than numbers, right off the bat (in the text1 keypress event):
Private Sub Text1_KeyPress(KeyAscii As Integer)
'
' Invalidate keystroke if not a digit, decimal point or backspace.
'
If (Not IsNumeric(Chr$(KeyAscii)) And (Chr$(KeyAscii) <> "." And Chr$(KeyAscii) <> vbBack)) Then KeyAscii = 0
End Sub
And then test between the int or long variable types using vartype as so:
if vartype(retval) = vbinteger then
msgbox "is integer"
end if
Here is a table of such data:
0 vbEmpty Empty and not initialized argument
1 vbNull Invalid data or a null string argument
2 vbInteger Integer argument
3 vbLong Long argument
4 vbSingle Single argument
5 vbDouble Double argument
6 vbCurrency Currency argument
7 vbDate Date argument
8 vbString String argument
9 vbObject Object argument
10 vbError Error argument
11 vbBoolean Boolean argument
12 vbVariant Variant argument
13 vbDataObject Data Access Object (DAO) argument; an advanced database value such as a field or record
14 vbDecimal Decimal argument
17 vbByte Byte argument
8192+int vbArray Array argument of the type specified by the int addition to 81920 vbEmpty Empty and not initialized
Now, as was stated above, a textbox will only return a string. There is no other means by which a textbox will contain data. A number, too, can be a string, "1" is a string, but it's a character that represents a digit. If you need a number in a specific variable type, though, you can "cast" it to the desired type. So, if you need the information in the textbox to be a long, you can simply assign a variable to it's cast type:
dim TypedData as long
TypedData = CLng(Text1.Text)
You could also do the same with integer values, as in
CInt(text1.text)